Version 20.39: Mar 02, 2021 Code refactoring in user's photo.

This commit is contained in:
acanas 2021-03-02 10:16:41 +01:00
parent d2dd0d1f8f
commit d4c5288ec3
21 changed files with 594 additions and 746 deletions

View File

@ -2070,8 +2070,6 @@ static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
struct Att_Event *Event) struct Att_Event *Event)
{ {
bool Present; bool Present;
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
char CommentStd[Cns_MAX_BYTES_TEXT + 1]; char CommentStd[Cns_MAX_BYTES_TEXT + 1];
char CommentTch[Cns_MAX_BYTES_TEXT + 1]; char CommentTch[Cns_MAX_BYTES_TEXT + 1];
bool ItsMe; bool ItsMe;
@ -2141,10 +2139,7 @@ static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
if (Gbl.Usrs.Listing.WithPhotos) if (Gbl.Usrs.Listing.WithPhotos)
{ {
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO45x60",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -3434,8 +3429,6 @@ static void Att_WriteTableHeadSeveralAttEvents (const struct Att_Events *Events)
static void Att_WriteRowUsrSeveralAttEvents (const struct Att_Events *Events, static void Att_WriteRowUsrSeveralAttEvents (const struct Att_Events *Events,
unsigned NumUsr,struct UsrData *UsrDat) unsigned NumUsr,struct UsrData *UsrDat)
{ {
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
unsigned NumAttEvent; unsigned NumAttEvent;
bool Present; bool Present;
unsigned NumTimesPresent; unsigned NumTimesPresent;
@ -3454,10 +3447,7 @@ static void Att_WriteRowUsrSeveralAttEvents (const struct Att_Events *Events,
if (Gbl.Usrs.Listing.WithPhotos) if (Gbl.Usrs.Listing.WithPhotos)
{ {
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -3588,8 +3578,6 @@ static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
{ {
extern const char *Txt_Student_comment; extern const char *Txt_Student_comment;
extern const char *Txt_Teachers_comment; extern const char *Txt_Teachers_comment;
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
unsigned NumAttEvent; unsigned NumAttEvent;
unsigned UniqueId; unsigned UniqueId;
char *Id; char *Id;
@ -3612,10 +3600,7 @@ static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
/***** Show student's photo *****/ /***** Show student's photo *****/
HTM_TD_Begin ("colspan=\"2\" class=\"RM COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("colspan=\"2\" class=\"RM COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/***** Write user's ID ******/ /***** Write user's ID ******/

View File

@ -598,10 +598,11 @@ TODO: DNI de un estudiante sale err
TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede. TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede.
TODO: Salvador Romero Cortés: @acanas opción para editar posts TODO: Salvador Romero Cortés: @acanas opción para editar posts
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.38.1 (2021-03-02)" #define Log_PLATFORM_VERSION "SWAD 20.39 (2021-03-02)"
#define CSS_FILE "swad20.33.9.css" #define CSS_FILE "swad20.33.9.css"
#define JS_FILE "swad20.6.2.js" #define JS_FILE "swad20.6.2.js"
/* /*
Version 20.39: Mar 02, 2021 Code refactoring in user's photo. (305610 lines)
Version 20.38.1: Mar 02, 2021 Code refactoring in timeline comments. (305768 lines) Version 20.38.1: Mar 02, 2021 Code refactoring in timeline comments. (305768 lines)
Version 20.38: Mar 02, 2021 Code refactoring in timeline. (305756 lines) Version 20.38: Mar 02, 2021 Code refactoring in timeline. (305756 lines)
Version 20.37: Mar 01, 2021 Code refactoring and more error messages in timeline. (305681 lines) Version 20.37: Mar 01, 2021 Code refactoring and more error messages in timeline. (305681 lines)

View File

@ -785,8 +785,6 @@ static void Con_ShowConnectedUsrsCurrentCrsOneByOneOnRightColumn (Rol_Role_t Rol
static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role) static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
{ {
extern const char *Txt_View_record_for_this_course; extern const char *Txt_View_record_for_this_course;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
const char *ClassTxt; const char *ClassTxt;
const char *ClassLink; const char *ClassLink;
long UsrCod; long UsrCod;
@ -816,10 +814,7 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
/***** Show photo *****/ /***** Show photo *****/
HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,true);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,true);
HTM_TD_End (); HTM_TD_End ();
/***** Write full name and link *****/ /***** Write full name and link *****/
@ -891,8 +886,6 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
unsigned NumUsr; unsigned NumUsr;
bool ThisCrs; bool ThisCrs;
time_t TimeDiff; time_t TimeDiff;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
const char *ClassTxt; const char *ClassTxt;
const char *ClassLink; const char *ClassLink;
struct UsrData UsrDat; struct UsrData UsrDat;
@ -1042,10 +1035,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
/***** Show photo *****/ /***** Show photo *****/
HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/***** Write full name and link *****/ /***** Write full name and link *****/

View File

@ -2263,8 +2263,6 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
struct UsrData UsrDat; struct UsrData UsrDat;
bool UsrExists; bool UsrExists;
bool UsrBelongsToCrs; bool UsrBelongsToCrs;
bool ShowPhoto = false;
char PhotoURL[PATH_MAX + 1];
Rol_Role_t DesiredRole; Rol_Role_t DesiredRole;
Act_Action_t NextAction; Act_Action_t NextAction;
@ -2878,10 +2876,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
/***** User photo *****/ /***** User photo *****/
HTM_TD_Begin ("class=\"DAT CT\" style=\"width:22px;\""); HTM_TD_Begin ("class=\"DAT CT\" style=\"width:22px;\"");
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/***** User name *****/ /***** User name *****/

View File

@ -1632,31 +1632,26 @@ static void ExaRes_ComputeValidPrintScore (struct ExaPrn_Print *Print)
void ExaRes_ShowExamResultUser (struct UsrData *UsrDat) void ExaRes_ShowExamResultUser (struct UsrData *UsrDat)
{ {
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
/***** Row begin *****/ /***** Row begin *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/***** Label *****/ /***** Label *****/
HTM_TD_Begin ("class=\"DAT_N RT\""); 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.Role][UsrDat->Sex]);
HTM_TD_End (); HTM_TD_End ();
/***** User's data *****/ /***** User's data *****/
HTM_TD_Begin ("class=\"DAT LB\""); HTM_TD_Begin ("class=\"DAT LB\"");
ID_WriteUsrIDs (UsrDat,NULL); ID_WriteUsrIDs (UsrDat,NULL);
HTM_TxtF (" %s",UsrDat->Surname1); HTM_TxtF (" %s",UsrDat->Surname1);
if (UsrDat->Surname2[0]) if (UsrDat->Surname2[0])
HTM_TxtF (" %s",UsrDat->Surname2); HTM_TxtF (" %s",UsrDat->Surname2);
if (UsrDat->FrstName[0]) if (UsrDat->FrstName[0])
HTM_TxtF (", %s",UsrDat->FrstName); HTM_TxtF (", %s",UsrDat->FrstName);
HTM_BR (); HTM_BR ();
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : HTM_TD_End ();
NULL,
"PHOTO45x60",Pho_ZOOM,false);
HTM_TD_End ();
/***** Row end *****/ /***** Row end *****/
HTM_TR_End (); HTM_TR_End ();

View File

@ -3369,67 +3369,63 @@ static void Brw_GetSelectedGroupData (struct GroupData *GrpDat,bool AbortOnError
static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat) static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
{ {
extern const char *Txt_View_record_for_this_course; extern const char *Txt_View_record_for_this_course;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
Act_Action_t NextAction; Act_Action_t NextAction;
/***** Show user's photo *****/ /***** Show user's photo *****/
HTM_TD_Begin ("class=\"OWNER_WORKS_PHOTO\""); HTM_TD_Begin ("class=\"OWNER_WORKS_PHOTO\"");
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO60x80",Pho_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO60x80",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/***** Begin form to send a message to this user *****/ /***** Begin form to send a message to this user *****/
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
HTM_DIV_Begin ("class=\"OWNER_WORKS_DATA AUTHOR_TXT\""); HTM_DIV_Begin ("class=\"OWNER_WORKS_DATA AUTHOR_TXT\"");
switch (UsrDat->Roles.InCurrentCrs.Role) switch (UsrDat->Roles.InCurrentCrs.Role)
{ {
case Rol_STD: case Rol_STD:
NextAction = ActSeeRecOneStd; NextAction = ActSeeRecOneStd;
break; break;
case Rol_NET: case Rol_NET:
case Rol_TCH: case Rol_TCH:
NextAction = ActSeeRecOneTch; NextAction = ActSeeRecOneTch;
break; break;
default: default:
NextAction = ActUnk; NextAction = ActUnk;
Rol_WrongRoleExit (); Rol_WrongRoleExit ();
break; break;
} }
Frm_BeginForm (NextAction); Frm_BeginForm (NextAction);
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
/***** Show user's ID *****/ /***** Show user's ID *****/
ID_WriteUsrIDs (UsrDat,NULL); ID_WriteUsrIDs (UsrDat,NULL);
/***** Show user's name *****/ /***** Show user's name *****/
HTM_BR (); HTM_BR ();
HTM_BUTTON_SUBMIT_Begin (Txt_View_record_for_this_course,"BT_LINK AUTHOR_TXT",NULL); HTM_BUTTON_SUBMIT_Begin (Txt_View_record_for_this_course,"BT_LINK AUTHOR_TXT",NULL);
HTM_Txt (UsrDat->Surname1); HTM_Txt (UsrDat->Surname1);
if (UsrDat->Surname2[0]) if (UsrDat->Surname2[0])
HTM_TxtF (" %s",UsrDat->Surname2); HTM_TxtF (" %s",UsrDat->Surname2);
if (UsrDat->FrstName[0]) if (UsrDat->FrstName[0])
HTM_TxtF (", %s",UsrDat->FrstName); HTM_TxtF (", %s",UsrDat->FrstName);
HTM_BUTTON_End (); HTM_BUTTON_End ();
/***** Show user's email *****/ /***** Show user's email *****/
if (UsrDat->Email[0]) if (UsrDat->Email[0])
{ {
HTM_BR (); HTM_BR ();
HTM_A_Begin ("href=\"mailto:%s\" target=\"_blank\" class=\"AUTHOR_TXT\"", HTM_A_Begin ("href=\"mailto:%s\" target=\"_blank\""
UsrDat->Email); " class=\"AUTHOR_TXT\"",
HTM_Txt (UsrDat->Email); UsrDat->Email);
HTM_A_End (); HTM_Txt (UsrDat->Email);
} HTM_A_End ();
Frm_EndForm (); }
HTM_DIV_End (); Frm_EndForm ();
HTM_DIV_End ();
HTM_TD_End (); HTM_TD_End ();
} }
@ -6463,8 +6459,6 @@ static void Brw_WriteFileOrFolderPublisher (unsigned Level,unsigned long UsrCod)
{ {
extern const char *Txt_Unknown_or_without_photo; extern const char *Txt_Unknown_or_without_photo;
bool ShowUsr = false; bool ShowUsr = false;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
struct UsrData UsrDat; struct UsrData UsrDat;
if (Level && UsrCod > 0) if (Level && UsrCod > 0)
@ -6479,13 +6473,8 @@ static void Brw_WriteFileOrFolderPublisher (unsigned Level,unsigned long UsrCod)
HTM_TD_Begin ("class=\"BM%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"BM%u\"",Gbl.RowEvenOdd);
if (ShowUsr) if (ShowUsr)
{
/***** Show photo *****/ /***** Show photo *****/
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO15x20B",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO15x20B",Pho_ZOOM,false);
}
else else
Ico_PutIcon ("usr_bl.jpg",Txt_Unknown_or_without_photo,"PHOTO15x20B"); Ico_PutIcon ("usr_bl.jpg",Txt_Unknown_or_without_photo,"PHOTO15x20B");
@ -9334,8 +9323,6 @@ void Brw_ShowFileMetadata (void)
bool ICanEdit; bool ICanEdit;
bool ICanChangePublic = false; bool ICanChangePublic = false;
bool FileHasPublisher; bool FileHasPublisher;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
Brw_License_t License; Brw_License_t License;
unsigned LicenseUnsigned; unsigned LicenseUnsigned;
@ -9486,10 +9473,7 @@ void Brw_ShowFileMetadata (void)
if (FileHasPublisher) if (FileHasPublisher)
{ {
/* Show photo */ /* Show photo */
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&PublisherUsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&PublisherUsrDat,"PHOTO15x20",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&PublisherUsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO15x20",Pho_ZOOM,false);
/* Write name */ /* Write name */
HTM_NBSP (); HTM_NBSP ();

View File

@ -823,52 +823,47 @@ static void Fol_ListFollowersUsr (struct UsrData *UsrDat)
static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat) static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
{ {
extern const char *Txt_Another_user_s_profile; extern const char *Txt_Another_user_s_profile;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat); bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod); bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
/***** Show user's photo *****/ /***** Show user's photo *****/
HTM_TD_Begin ("class=\"FOLLOW_PHOTO\""); HTM_TD_Begin ("class=\"FOLLOW_PHOTO\"");
if (Visible) if (Visible)
{ Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO60x80",Pho_ZOOM,false);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO60x80",Pho_ZOOM,false);
}
HTM_TD_End (); HTM_TD_End ();
/***** Show user's name and icon to follow/unfollow *****/ /***** Show user's name and icon to follow/unfollow *****/
HTM_TD_Begin ("class=\"FOLLOW_USR\""); HTM_TD_Begin ("class=\"FOLLOW_USR\"");
if (Visible)
{
/* Put form to go to public profile */
Frm_BeginForm (ActSeeOthPubPrf);
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
HTM_DIV_Begin ("class=\"FOLLOW_USR_NAME\""); // Limited width
HTM_BUTTON_SUBMIT_Begin (Txt_Another_user_s_profile,"BT_LINK LT DAT",NULL);
Usr_WriteFirstNameBRSurnames (UsrDat);
HTM_BUTTON_End ();
HTM_DIV_End ();
Frm_EndForm ();
}
ItsMe = Usr_ItsMe (UsrDat->UsrCod); if (Visible)
if (!Gbl.Usrs.Me.Logged || // Not logged {
ItsMe) // It's me /* Put form to go to public profile */
/* Inactive icon to follow/unfollow */ Frm_BeginForm (ActSeeOthPubPrf);
Fol_PutInactiveIconToFollowUnfollow (); Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
else // It's not me HTM_DIV_Begin ("class=\"FOLLOW_USR_NAME\""); // Limited width
{ HTM_BUTTON_SUBMIT_Begin (Txt_Another_user_s_profile,"BT_LINK LT DAT",NULL);
/* Put form to follow / unfollow */ Usr_WriteFirstNameBRSurnames (UsrDat);
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user HTM_BUTTON_End ();
/* Form to unfollow */ HTM_DIV_End ();
Fol_PutIconToUnfollow (UsrDat); Frm_EndForm ();
else if (Visible) // I do not follow this user and I can follow }
/* Form to follow */
Fol_PutIconToFollow (UsrDat); ItsMe = Usr_ItsMe (UsrDat->UsrCod);
} if (!Gbl.Usrs.Me.Logged || // Not logged
ItsMe) // It's me
/* Inactive icon to follow/unfollow */
Fol_PutInactiveIconToFollowUnfollow ();
else // It's not me
{
/* Put form to follow / unfollow */
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user
/* Form to unfollow */
Fol_PutIconToUnfollow (UsrDat);
else if (Visible) // I do not follow this user and I can follow
/* Form to follow */
Fol_PutIconToFollow (UsrDat);
}
HTM_TD_End (); HTM_TD_End ();
} }
@ -879,56 +874,52 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat) static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
{ {
extern const char *Txt_Another_user_s_profile; extern const char *Txt_Another_user_s_profile;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat); bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
bool ItsMe = Usr_ItsMe (UsrDat->UsrCod); bool ItsMe = Usr_ItsMe (UsrDat->UsrCod);
/***** Show user's photo *****/ /***** Show user's photo *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd);
if (Visible)
{
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
}
HTM_TD_End ();
/***** User's name *****/ HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd);
HTM_TD_Begin ("class=\"CON_NAME_FOLLOW COLOR%u\"",Gbl.RowEvenOdd); if (Visible)
if (Visible) Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false);
{ HTM_TD_End ();
/* Put form to go to public profile */
Frm_BeginForm (ActSeeOthPubPrf); /***** User's name *****/
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod); HTM_TD_Begin ("class=\"CON_NAME_FOLLOW COLOR%u\"",Gbl.RowEvenOdd);
HTM_DIV_Begin ("class=\"CON_NAME_FOLLOW\""); // Limited width if (Visible)
HTM_BUTTON_SUBMIT_Begin (Txt_Another_user_s_profile,"BT_LINK CON_NAME_FOLLOW CON_CRS",NULL); {
Usr_WriteFirstNameBRSurnames (UsrDat); /* Put form to go to public profile */
HTM_BUTTON_End (); Frm_BeginForm (ActSeeOthPubPrf);
HTM_DIV_End (); Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
Frm_EndForm (); HTM_DIV_Begin ("class=\"CON_NAME_FOLLOW\""); // Limited width
} HTM_BUTTON_SUBMIT_Begin (Txt_Another_user_s_profile,
HTM_TD_End (); "BT_LINK CON_NAME_FOLLOW CON_CRS",NULL);
Usr_WriteFirstNameBRSurnames (UsrDat);
HTM_BUTTON_End ();
HTM_DIV_End ();
Frm_EndForm ();
}
HTM_TD_End ();
/***** Icon to follow *****/
HTM_TD_Begin ("class=\"CON_ICON_FOLLOW RM COLOR%u\"",Gbl.RowEvenOdd);
if (!Gbl.Usrs.Me.Logged || // Not logged
ItsMe) // It's me
/* Inactive icon to follow/unfollow */
Fol_PutInactiveIconToFollowUnfollow ();
else // It's not me
{
/* Put form to follow / unfollow */
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user
/* Form to unfollow */
Fol_PutIconToUnfollow (UsrDat);
else if (Visible) // I do not follow this user and I can follow
/* Form to follow */
Fol_PutIconToFollow (UsrDat);
}
HTM_TD_End ();
/***** Icon to follow *****/
HTM_TD_Begin ("class=\"CON_ICON_FOLLOW RM COLOR%u\"",Gbl.RowEvenOdd);
if (!Gbl.Usrs.Me.Logged || // Not logged
ItsMe) // It's me
/* Inactive icon to follow/unfollow */
Fol_PutInactiveIconToFollowUnfollow ();
else // It's not me
{
/* Put form to follow / unfollow */
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDat->UsrCod)) // I follow user
/* Form to unfollow */
Fol_PutIconToUnfollow (UsrDat);
else if (Visible) // I do not follow this user and I can follow
/* Form to follow */
Fol_PutIconToFollow (UsrDat);
}
HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;

View File

@ -1159,8 +1159,6 @@ void MchRes_ShowOneMchResult (void)
Dat_StartEndTime_t StartEndTime; Dat_StartEndTime_t StartEndTime;
char *Id; char *Id;
struct MchPrn_Print Print; struct MchPrn_Print Print;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
struct MchRes_ICanView ICanView; struct MchRes_ICanView ICanView;
/***** Reset games context *****/ /***** Reset games context *****/
@ -1205,157 +1203,154 @@ void MchRes_ShowOneMchResult (void)
Box_BoxBegin (NULL,Match.Title, Box_BoxBegin (NULL,Match.Title,
NULL,NULL, NULL,NULL,
Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE); Hlp_ASSESSMENT_Games_results,Box_NOT_CLOSABLE);
Lay_WriteHeaderClassPhoto (false,false, Lay_WriteHeaderClassPhoto (false,false,
Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Ins.InsCod,
Gbl.Hierarchy.Deg.DegCod, Gbl.Hierarchy.Deg.DegCod,
Gbl.Hierarchy.Crs.CrsCod); Gbl.Hierarchy.Crs.CrsCod);
/***** Begin table *****/ /***** Begin table *****/
HTM_TABLE_BeginWideMarginPadding (10); HTM_TABLE_BeginWideMarginPadding (10);
/***** User *****/ /***** User *****/
/* Get data of the user who answer the match */ /* Get data of the user who answer the match */
if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS)) if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat,Usr_DONT_GET_PREFS))
Lay_ShowErrorAndExit (Txt_The_user_does_not_exist); Lay_ShowErrorAndExit (Txt_The_user_does_not_exist);
if (!Usr_CheckIfICanViewTstExaMchResult (UsrDat)) if (!Usr_CheckIfICanViewTstExaMchResult (UsrDat))
Lay_NoPermissionExit (); Lay_NoPermissionExit ();
/* User */ /* User */
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT_N RT\""); 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.Role][UsrDat->Sex]);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT LB\""); HTM_TD_Begin ("class=\"DAT LB\"");
ID_WriteUsrIDs (UsrDat,NULL); ID_WriteUsrIDs (UsrDat,NULL);
HTM_TxtF (" %s",UsrDat->Surname1); HTM_TxtF (" %s",UsrDat->Surname1);
if (UsrDat->Surname2[0]) if (UsrDat->Surname2[0])
HTM_TxtF (" %s",UsrDat->Surname2); HTM_TxtF (" %s",UsrDat->Surname2);
if (UsrDat->FrstName[0]) if (UsrDat->FrstName[0])
HTM_TxtF (", %s",UsrDat->FrstName); HTM_TxtF (", %s",UsrDat->FrstName);
HTM_BR (); HTM_BR ();
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : HTM_TD_End ();
NULL,
"PHOTO45x60",Pho_ZOOM,false);
HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
/***** Start/end time (for user in this match) *****/ /***** Start/end time (for user in this match) *****/
for (StartEndTime = (Dat_StartEndTime_t) 0; for (StartEndTime = (Dat_StartEndTime_t) 0;
StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1); StartEndTime <= (Dat_StartEndTime_t) (Dat_NUM_START_END_TIME - 1);
StartEndTime++) StartEndTime++)
{ {
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT_N RT\""); HTM_TD_Begin ("class=\"DAT_N RT\"");
HTM_TxtColon (Txt_START_END_TIME[StartEndTime]); HTM_TxtColon (Txt_START_END_TIME[StartEndTime]);
HTM_TD_End (); HTM_TD_End ();
if (asprintf (&Id,"match_%u",(unsigned) StartEndTime) < 0) if (asprintf (&Id,"match_%u",(unsigned) StartEndTime) < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
HTM_TD_Begin ("id=\"%s\" class=\"DAT LB\"",Id); HTM_TD_Begin ("id=\"%s\" class=\"DAT LB\"",Id);
Dat_WriteLocalDateHMSFromUTC (Id,Print.TimeUTC[StartEndTime], Dat_WriteLocalDateHMSFromUTC (Id,Print.TimeUTC[StartEndTime],
Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA, Gbl.Prefs.DateFormat,Dat_SEPARATOR_COMMA,
true,true,true,0x7); true,true,true,0x7);
HTM_TD_End (); HTM_TD_End ();
free (Id); free (Id);
HTM_TR_End (); HTM_TR_End ();
} }
/***** Number of questions *****/ /***** Number of questions *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT_N RT\""); HTM_TD_Begin ("class=\"DAT_N RT\"");
HTM_TxtColon (Txt_Questions); HTM_TxtColon (Txt_Questions);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT LB\""); HTM_TD_Begin ("class=\"DAT LB\"");
HTM_Unsigned (Print.NumQsts.All); HTM_Unsigned (Print.NumQsts.All);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
/***** Number of answers *****/ /***** Number of answers *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT_N RT\""); HTM_TD_Begin ("class=\"DAT_N RT\"");
HTM_TxtColon (Txt_Answers); HTM_TxtColon (Txt_Answers);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT LB\""); HTM_TD_Begin ("class=\"DAT LB\"");
HTM_Unsigned (Print.NumQsts.NotBlank); HTM_Unsigned (Print.NumQsts.NotBlank);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
/***** Score *****/ /***** Score *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT_N RT\""); HTM_TD_Begin ("class=\"DAT_N RT\"");
HTM_TxtColon (Txt_Score); HTM_TxtColon (Txt_Score);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT LB\""); HTM_TD_Begin ("class=\"DAT LB\"");
if (ICanView.Score) if (ICanView.Score)
{ {
HTM_STRONG_Begin (); HTM_STRONG_Begin ();
HTM_Double2Decimals (Print.Score); HTM_Double2Decimals (Print.Score);
HTM_Txt ("/"); HTM_Txt ("/");
HTM_Unsigned (Print.NumQsts.All); HTM_Unsigned (Print.NumQsts.All);
HTM_STRONG_End (); HTM_STRONG_End ();
} }
else else
Ico_PutIconNotVisible (); Ico_PutIconNotVisible ();
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
/***** Grade *****/ /***** Grade *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT_N RT\""); HTM_TD_Begin ("class=\"DAT_N RT\"");
HTM_TxtColon (Txt_Grade); HTM_TxtColon (Txt_Grade);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT LB\""); HTM_TD_Begin ("class=\"DAT LB\"");
if (ICanView.Score) if (ICanView.Score)
{ {
HTM_STRONG_Begin (); HTM_STRONG_Begin ();
TstPrn_ComputeAndShowGrade (Print.NumQsts.All,Print.Score,Game.MaxGrade); TstPrn_ComputeAndShowGrade (Print.NumQsts.All,Print.Score,Game.MaxGrade);
HTM_STRONG_End (); HTM_STRONG_End ();
} }
else else
Ico_PutIconNotVisible (); Ico_PutIconNotVisible ();
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
/***** Tags present in this result *****/ /***** Tags present in this result *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT_N RT\""); HTM_TD_Begin ("class=\"DAT_N RT\"");
HTM_TxtColon (Txt_Tags); HTM_TxtColon (Txt_Tags);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT LB\""); HTM_TD_Begin ("class=\"DAT LB\"");
Gam_ShowTstTagsPresentInAGame (Match.GamCod); Gam_ShowTstTagsPresentInAGame (Match.GamCod);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
/***** Write answers and solutions *****/ /***** Write answers and solutions *****/
TstPrn_ShowPrintAnswers (UsrDat, TstPrn_ShowPrintAnswers (UsrDat,
Print.NumQsts.All, Print.NumQsts.All,
Print.PrintedQuestions, Print.PrintedQuestions,
Print.TimeUTC, Print.TimeUTC,
Game.Visibility); Game.Visibility);
/***** End table *****/ /***** End table *****/
HTM_TABLE_End (); HTM_TABLE_End ();
/***** End box *****/ /***** End box *****/
Box_BoxEnd (); Box_BoxEnd ();

View File

@ -500,27 +500,21 @@ static void Msg_PutHiddenParamsSubjectAndContent (void)
static void Msg_ShowOneUniqueRecipient (void) static void Msg_ShowOneUniqueRecipient (void)
{ {
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
/***** Show user's photo *****/ /***** Show user's photo *****/
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,"PHOTO21x28",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
/****** Write user's IDs ******/ /****** Write user's IDs ******/
HTM_DIV_Begin ("class=\"MSG_TO_ONE_RCP %s\"", HTM_DIV_Begin ("class=\"MSG_TO_ONE_RCP %s\"",
Gbl.Usrs.Other.UsrDat.Accepted ? "DAT_SMALL_NOBR_N" : Gbl.Usrs.Other.UsrDat.Accepted ? "DAT_SMALL_NOBR_N" :
"DAT_SMALL_NOBR"); "DAT_SMALL_NOBR");
ID_WriteUsrIDs (&Gbl.Usrs.Other.UsrDat,NULL); ID_WriteUsrIDs (&Gbl.Usrs.Other.UsrDat,NULL);
HTM_DIV_End (); HTM_DIV_End ();
/***** Write user's name *****/ /***** Write user's name *****/
HTM_DIV_Begin ("class=\"MSG_TO_ONE_RCP %s\"", HTM_DIV_Begin ("class=\"MSG_TO_ONE_RCP %s\"",
Gbl.Usrs.Other.UsrDat.Accepted ? "DAT_SMALL_NOBR_N" : Gbl.Usrs.Other.UsrDat.Accepted ? "DAT_SMALL_NOBR_N" :
"DAT_SMALL_NOBR"); "DAT_SMALL_NOBR");
HTM_Txt (Gbl.Usrs.Other.UsrDat.FullName); HTM_Txt (Gbl.Usrs.Other.UsrDat.FullName);
HTM_DIV_End (); HTM_DIV_End ();
/***** Hidden parameter with user's nickname *****/ /***** Hidden parameter with user's nickname *****/
@ -3393,8 +3387,6 @@ static void Msg_WriteSentOrReceivedMsgSubject (struct Msg_Messages *Messages,
void Msg_WriteMsgAuthor (struct UsrData *UsrDat,bool Enabled,const char *BgColor) void Msg_WriteMsgAuthor (struct UsrData *UsrDat,bool Enabled,const char *BgColor)
{ {
extern const char *Txt_Unknown_or_without_photo; extern const char *Txt_Unknown_or_without_photo;
bool ShowPhoto = false;
char PhotoURL[PATH_MAX + 1];
bool WriteAuthor; bool WriteAuthor;
/***** Write author name or don't write it? *****/ /***** Write author name or don't write it? *****/
@ -3405,51 +3397,47 @@ void Msg_WriteMsgAuthor (struct UsrData *UsrDat,bool Enabled,const char *BgColor
/***** Begin table and row *****/ /***** Begin table and row *****/
HTM_TABLE_BeginPadding (2); HTM_TABLE_BeginPadding (2);
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/***** Start first column with author's photo /***** Start first column with author's photo
(if author has a web page, put a link to it) *****/ (if author has a web page, put a link to it) *****/
if (BgColor) if (BgColor)
HTM_TD_Begin ("class=\"CT %s\" style=\"width:30px;\"",BgColor); HTM_TD_Begin ("class=\"CT %s\" style=\"width:30px;\"",BgColor);
else else
HTM_TD_Begin ("class=\"CT\" style=\"width:30px;\""); HTM_TD_Begin ("class=\"CT\" style=\"width:30px;\"");
if (WriteAuthor) if (WriteAuthor)
{ Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO30x40",Pho_ZOOM,false);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); else
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : Ico_PutIcon ("usr_bl.jpg",Txt_Unknown_or_without_photo,"PHOTO30x40");
NULL,
"PHOTO30x40",Pho_ZOOM,false);
}
else
Ico_PutIcon ("usr_bl.jpg",Txt_Unknown_or_without_photo,"PHOTO30x40");
HTM_TD_End ();
/***** Second column with user name (if author has a web page, put a link to it) *****/ HTM_TD_End ();
if (WriteAuthor)
{
if (BgColor)
HTM_TD_Begin ("class=\"LT %s\"",BgColor);
else
HTM_TD_Begin ("class=\"LT\"");
HTM_DIV_Begin ("class=\"AUTHOR_2_LINES\""); // Limited width /***** Second column with user name (if author has a web page, put a link to it) *****/
Usr_WriteFirstNameBRSurnames (UsrDat); if (WriteAuthor)
HTM_DIV_End (); {
} if (BgColor)
else HTM_TD_Begin ("class=\"LT %s\"",BgColor);
{ else
if (BgColor) HTM_TD_Begin ("class=\"LT\"");
HTM_TD_Begin ("class=\"LM %s\"",BgColor);
else
HTM_TD_Begin ("class=\"LM\"");
}
/***** End second column *****/ HTM_DIV_Begin ("class=\"AUTHOR_2_LINES\""); // Limited width
HTM_TD_End (); Usr_WriteFirstNameBRSurnames (UsrDat);
HTM_DIV_End ();
}
else
{
if (BgColor)
HTM_TD_Begin ("class=\"LM %s\"",BgColor);
else
HTM_TD_Begin ("class=\"LM\"");
}
/***** End row and table *****/ /***** End second column *****/
HTM_TR_End (); HTM_TD_End ();
/***** End row and table *****/
HTM_TR_End ();
HTM_TABLE_End (); HTM_TABLE_End ();
} }
@ -3555,50 +3543,45 @@ static void Msg_WriteMsgFrom (struct Msg_Messages *Messages,
extern const char *Txt_MSG_Sent; extern const char *Txt_MSG_Sent;
extern const char *Txt_MSG_Sent_and_deleted; extern const char *Txt_MSG_Sent_and_deleted;
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
HTM_TABLE_Begin (NULL); HTM_TABLE_Begin (NULL);
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/***** Put an icon to show if user has read the message *****/ /***** Put an icon to show if user has read the message *****/
HTM_TD_Begin ("class=\"LM\" style=\"width:20px;\""); HTM_TD_Begin ("class=\"LM\" style=\"width:20px;\"");
Ico_PutIcon (Deleted ? "share-red.svg" : Ico_PutIcon (Deleted ? "share-red.svg" :
"share.svg", "share.svg",
Deleted ? Txt_MSG_Sent_and_deleted : Deleted ? Txt_MSG_Sent_and_deleted :
Txt_MSG_Sent, Txt_MSG_Sent,
"ICO16x16"); "ICO16x16");
HTM_TD_End (); HTM_TD_End ();
/***** Put user's photo *****/ /***** Put user's photo *****/
HTM_TD_Begin ("class=\"CM\" style=\"width:30px;\""); HTM_TD_Begin ("class=\"CM\" style=\"width:30px;\"");
ShowPhoto = (Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL)); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : HTM_TD_End ();
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End ();
/***** Write user's name *****/ /***** Write user's name *****/
HTM_TD_Begin ("class=\"AUTHOR_TXT LM\""); HTM_TD_Begin ("class=\"AUTHOR_TXT LM\"");
if (UsrDat->UsrCod > 0) if (UsrDat->UsrCod > 0)
{ {
HTM_Txt (UsrDat->FullName); HTM_Txt (UsrDat->FullName);
if (Act_GetSuperAction (Gbl.Action.Act) == ActSeeRcvMsg) if (Act_GetSuperAction (Gbl.Action.Act) == ActSeeRcvMsg)
{ {
HTM_NBSP (); HTM_NBSP ();
if (Msg_CheckIfUsrIsBanned (UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod)) if (Msg_CheckIfUsrIsBanned (UsrDat->UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod))
// Sender is banned // Sender is banned
Msg_PutFormToUnbanSender (Messages,UsrDat); Msg_PutFormToUnbanSender (Messages,UsrDat);
else else
// Sender is not banned // Sender is not banned
Msg_PutFormToBanSender (Messages,UsrDat); Msg_PutFormToBanSender (Messages,UsrDat);
} }
} }
else else
HTM_TxtF ("[%s]",Txt_ROLES_SINGUL_abc[Rol_UNK][Usr_SEX_UNKNOWN]); // User not found, likely an old user who has been removed HTM_TxtF ("[%s]",Txt_ROLES_SINGUL_abc[Rol_UNK][Usr_SEX_UNKNOWN]); // User not found, likely an old user who has been removed
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
HTM_TABLE_End (); HTM_TABLE_End ();
} }
@ -4021,8 +4004,6 @@ void Msg_ListBannedUsrs (void)
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumUsr,NumUsrs; unsigned NumUsr,NumUsrs;
struct UsrData UsrDat; struct UsrData UsrDat;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
/***** Get my banned users *****/ /***** Get my banned users *****/
NumUsrs = (unsigned) DB_QuerySELECT (&mysql_res,"can not get banned users", NumUsrs = (unsigned) DB_QuerySELECT (&mysql_res,"can not get banned users",
@ -4072,10 +4053,7 @@ void Msg_ListBannedUsrs (void)
/* Show photo */ /* Show photo */
HTM_TD_Begin ("class=\"LM\" style=\"width:30px;\""); HTM_TD_Begin ("class=\"LM\" style=\"width:30px;\"");
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/* Write user's full name */ /* Write user's full name */

View File

@ -983,13 +983,30 @@ void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod)
UsrCod); UsrCod);
} }
/*****************************************************************************/
/********************* Show a user's photo if allowed ************************/
/*****************************************************************************/
void Pho_ShowUsrPhotoIfAllowed (struct UsrData *UsrDat,
const char *ClassPhoto,Pho_Zoom_t Zoom,
bool FormUnique)
{
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
ClassPhoto,Zoom,FormUnique);
}
/*****************************************************************************/ /*****************************************************************************/
/********************* Check if user's photo can be shown ********************/ /********************* Check if user's photo can be shown ********************/
/*****************************************************************************/ /*****************************************************************************/
// Returns true if the photo can be shown and false if not. // Returns true if the photo can be shown and false if not.
// Public photo means two different things depending on the user's type // Public photo means two different things depending on the user's type
bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,char PhotoURL[PATH_MAX + 1]) bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,
char PhotoURL[PATH_MAX + 1])
{ {
bool ICanSeePhoto; bool ICanSeePhoto;
@ -1058,102 +1075,7 @@ bool Pho_CheckIfPrivPhotoExists (long UsrCod,char PathPrivRelPhoto[PATH_MAX + 1]
} }
/*****************************************************************************/ /*****************************************************************************/
/************************** Remove a user's photo ****************************/ /*************************** Show a user's photo *****************************/
/*****************************************************************************/
// Returns true on success, false on error
bool Pho_RemovePhoto (struct UsrData *UsrDat)
{
extern const char *Txt_Photo_removed;
char PathPrivRelPhoto[PATH_MAX + 1];
char PathPublPhoto[PATH_MAX + 1];
unsigned NumErrors = 0;
if (UsrDat->Photo[0])
{
/***** Clear photo name in database *****/
Pho_ClearPhotoName (UsrDat->UsrCod);
/***** Remove public link *****/
snprintf (PathPublPhoto,sizeof (PathPublPhoto),"%s/%s.jpg",
Cfg_PATH_PHOTO_PUBLIC,UsrDat->Photo);
if (Fil_CheckIfPathExists (PathPublPhoto)) // Public link exists
if (unlink (PathPublPhoto)) // Remove public link
NumErrors++;
/***** Remove photo *****/
snprintf (PathPrivRelPhoto,sizeof (PathPrivRelPhoto),"%s/%02u/%ld.jpg",
Cfg_PATH_PHOTO_PRIVATE,
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
if (Fil_CheckIfPathExists (PathPrivRelPhoto)) // Photo exists
{
if (unlink (PathPrivRelPhoto)) // Remove photo
NumErrors++;
}
/***** Remove original photo *****/
snprintf (PathPrivRelPhoto,sizeof (PathPrivRelPhoto),
"%s/%02u/%ld_original.jpg",
Cfg_PATH_PHOTO_PRIVATE,
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
if (Fil_CheckIfPathExists (PathPrivRelPhoto)) // Original photo exists
if (unlink (PathPrivRelPhoto)) // Remove original photo
NumErrors++;
/***** Clear photo name in user's data *****/
UsrDat->Photo[0] = '\0';
}
if (NumErrors)
{
Ale_CreateAlert (Ale_ERROR,NULL,
"Error removing photo.");
return false;
}
else
{
Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_Photo_removed);
return true;
}
}
/*****************************************************************************/
/****************** Clear photo name of an user in database ******************/
/*****************************************************************************/
static void Pho_ClearPhotoName (long UsrCod)
{
/***** Clear photo name in user's data *****/
DB_QueryUPDATE ("can not clear the name of a user's photo",
"UPDATE usr_data SET Photo='' WHERE UsrCod=%ld",
UsrCod);
}
/*****************************************************************************/
/***************** Update photo name of an user in database ******************/
/*****************************************************************************/
void Pho_UpdatePhotoName (struct UsrData *UsrDat)
{
char PathPublPhoto[PATH_MAX + 1];
/***** Update photo name in database *****/
DB_QueryUPDATE ("can not update the name of a user's photo",
"UPDATE usr_data SET Photo='%s' WHERE UsrCod=%ld",
Gbl.UniqueNameEncrypted,UsrDat->UsrCod);
/***** Remove the old symbolic link to photo *****/
snprintf (PathPublPhoto,sizeof (PathPublPhoto),"%s/%s.jpg",
Cfg_PATH_PHOTO_PUBLIC,UsrDat->Photo);
unlink (PathPublPhoto); // Remove public link
/***** Update photo name in user's data *****/
Str_Copy (UsrDat->Photo,Gbl.UniqueNameEncrypted,sizeof (UsrDat->Photo) - 1);
}
/*****************************************************************************/
/****************** Write code to show the photo of a user *******************/
/*****************************************************************************/ /*****************************************************************************/
void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
@ -1302,6 +1224,101 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
} }
} }
/*****************************************************************************/
/************************** Remove a user's photo ****************************/
/*****************************************************************************/
// Returns true on success, false on error
bool Pho_RemovePhoto (struct UsrData *UsrDat)
{
extern const char *Txt_Photo_removed;
char PathPrivRelPhoto[PATH_MAX + 1];
char PathPublPhoto[PATH_MAX + 1];
unsigned NumErrors = 0;
if (UsrDat->Photo[0])
{
/***** Clear photo name in database *****/
Pho_ClearPhotoName (UsrDat->UsrCod);
/***** Remove public link *****/
snprintf (PathPublPhoto,sizeof (PathPublPhoto),"%s/%s.jpg",
Cfg_PATH_PHOTO_PUBLIC,UsrDat->Photo);
if (Fil_CheckIfPathExists (PathPublPhoto)) // Public link exists
if (unlink (PathPublPhoto)) // Remove public link
NumErrors++;
/***** Remove photo *****/
snprintf (PathPrivRelPhoto,sizeof (PathPrivRelPhoto),"%s/%02u/%ld.jpg",
Cfg_PATH_PHOTO_PRIVATE,
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
if (Fil_CheckIfPathExists (PathPrivRelPhoto)) // Photo exists
{
if (unlink (PathPrivRelPhoto)) // Remove photo
NumErrors++;
}
/***** Remove original photo *****/
snprintf (PathPrivRelPhoto,sizeof (PathPrivRelPhoto),
"%s/%02u/%ld_original.jpg",
Cfg_PATH_PHOTO_PRIVATE,
(unsigned) (UsrDat->UsrCod % 100),UsrDat->UsrCod);
if (Fil_CheckIfPathExists (PathPrivRelPhoto)) // Original photo exists
if (unlink (PathPrivRelPhoto)) // Remove original photo
NumErrors++;
/***** Clear photo name in user's data *****/
UsrDat->Photo[0] = '\0';
}
if (NumErrors)
{
Ale_CreateAlert (Ale_ERROR,NULL,
"Error removing photo.");
return false;
}
else
{
Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_Photo_removed);
return true;
}
}
/*****************************************************************************/
/****************** Clear photo name of an user in database ******************/
/*****************************************************************************/
static void Pho_ClearPhotoName (long UsrCod)
{
/***** Clear photo name in user's data *****/
DB_QueryUPDATE ("can not clear the name of a user's photo",
"UPDATE usr_data SET Photo='' WHERE UsrCod=%ld",
UsrCod);
}
/*****************************************************************************/
/***************** Update photo name of an user in database ******************/
/*****************************************************************************/
void Pho_UpdatePhotoName (struct UsrData *UsrDat)
{
char PathPublPhoto[PATH_MAX + 1];
/***** Update photo name in database *****/
DB_QueryUPDATE ("can not update the name of a user's photo",
"UPDATE usr_data SET Photo='%s' WHERE UsrCod=%ld",
Gbl.UniqueNameEncrypted,UsrDat->UsrCod);
/***** Remove the old symbolic link to photo *****/
snprintf (PathPublPhoto,sizeof (PathPublPhoto),"%s/%s.jpg",
Cfg_PATH_PHOTO_PUBLIC,UsrDat->Photo);
unlink (PathPublPhoto); // Remove public link
/***** Update photo name in user's data *****/
Str_Copy (UsrDat->Photo,Gbl.UniqueNameEncrypted,sizeof (UsrDat->Photo) - 1);
}
/*****************************************************************************/ /*****************************************************************************/
/************************** Change photo visibility **************************/ /************************** Change photo visibility **************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -116,15 +116,20 @@ void Pho_UpdateUsrPhoto2 (void);
unsigned Pho_UpdateMyClicksWithoutPhoto (void); unsigned Pho_UpdateMyClicksWithoutPhoto (void);
void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod); void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod);
bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,char PhotoURL[PATH_MAX + 1]); void Pho_ShowUsrPhotoIfAllowed (struct UsrData *UsrDat,
const char *ClassPhoto,Pho_Zoom_t Zoom,
bool FormUnique);
bool Pho_ShowingUsrPhotoIsAllowed (struct UsrData *UsrDat,
char PhotoURL[PATH_MAX + 1]);
bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char PhotoURL[PATH_MAX + 1]); bool Pho_BuildLinkToPhoto (const struct UsrData *UsrDat,char PhotoURL[PATH_MAX + 1]);
bool Pho_CheckIfPrivPhotoExists (long UsrCod,char PathPrivRelPhoto[PATH_MAX + 1]); bool Pho_CheckIfPrivPhotoExists (long UsrCod,char PathPrivRelPhoto[PATH_MAX + 1]);
bool Pho_RemovePhoto (struct UsrData *UsrDat);
void Pho_UpdatePhotoName (struct UsrData *UsrDat);
void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
const char *ClassPhoto,Pho_Zoom_t Zoom, const char *ClassPhoto,Pho_Zoom_t Zoom,
bool FormUnique); bool FormUnique);
bool Pho_RemovePhoto (struct UsrData *UsrDat);
void Pho_UpdatePhotoName (struct UsrData *UsrDat);
void Pho_ChangePhotoVisibility (void); void Pho_ChangePhotoVisibility (void);
void Pho_CalcPhotoDegree (void); void Pho_CalcPhotoDegree (void);

View File

@ -1756,42 +1756,35 @@ void Prf_GetAndShowRankingClicksPerDay (void)
static void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank,bool ItsMe) static void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank,bool ItsMe)
{ {
extern const char *Txt_Another_user_s_profile; extern const char *Txt_Another_user_s_profile;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat); bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
HTM_TD_Begin ("class=\"RM %s COLOR%u\"", HTM_TD_Begin ("class=\"RM %s COLOR%u\"",
ItsMe ? "DAT_SMALL_N" : ItsMe ? "DAT_SMALL_N" :
"DAT_SMALL", "DAT_SMALL",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
HTM_TxtF ("#%u",Rank); HTM_TxtF ("#%u",Rank);
HTM_TD_End (); HTM_TD_End ();
/***** Check if I can see the public profile *****/ /***** Check if I can see the public profile *****/
HTM_TD_Begin ("class=\"RANK_PHOTO COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"RANK_PHOTO COLOR%u\"",Gbl.RowEvenOdd);
if (Visible) if (Visible)
{ /***** User's photo *****/
/***** User's photo *****/ Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO30x40",Pho_ZOOM,false);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO30x40",Pho_ZOOM,false);
}
HTM_TD_End (); HTM_TD_End ();
/***** Put form to go to public profile *****/ /***** Put form to go to public profile *****/
HTM_TD_Begin ("class=\"COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"COLOR%u\"",Gbl.RowEvenOdd);
if (Visible) if (Visible)
{ {
Frm_BeginForm (ActSeeOthPubPrf); Frm_BeginForm (ActSeeOthPubPrf);
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
HTM_BUTTON_SUBMIT_Begin (Txt_Another_user_s_profile, HTM_BUTTON_SUBMIT_Begin (Txt_Another_user_s_profile,
ItsMe ? "BT_LINK RANK_USR DAT_SMALL_N" : ItsMe ? "BT_LINK RANK_USR DAT_SMALL_N" :
"BT_LINK RANK_USR DAT_SMALL", "BT_LINK RANK_USR DAT_SMALL",
NULL); // Limited width NULL); // Limited width
Usr_WriteFirstNameBRSurnames (UsrDat); Usr_WriteFirstNameBRSurnames (UsrDat);
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
} }
HTM_TD_End (); HTM_TD_End ();
} }

View File

@ -2033,8 +2033,6 @@ static void Prj_ShowOneProjectMembersWithARole (struct Prj_Projects *Projects,
bool WriteRow; bool WriteRow;
unsigned NumUsr; unsigned NumUsr;
unsigned NumUsrs; unsigned NumUsrs;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
const char *ClassLabel; const char *ClassLabel;
const char *ClassData; const char *ClassData;
static const Act_Action_t ActionReqRemUsr[Prj_NUM_ROLES_IN_PROJECT] = static const Act_Action_t ActionReqRemUsr[Prj_NUM_ROLES_IN_PROJECT] =
@ -2142,10 +2140,7 @@ static void Prj_ShowOneProjectMembersWithARole (struct Prj_Projects *Projects,
/* Put user's photo */ /* Put user's photo */
HTM_TD_Begin ("class=\"PRJ_MEMBER_PHO\""); HTM_TD_Begin ("class=\"PRJ_MEMBER_PHO\"");
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,"PHOTO21x28",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/* Write user's name */ /* Write user's name */

View File

@ -2710,14 +2710,9 @@ static void Rec_ShowInstitutionInHead (struct Ins_Instit *Ins,bool PutFormLinks)
static void Rec_ShowPhoto (struct UsrData *UsrDat) static void Rec_ShowPhoto (struct UsrData *UsrDat)
{ {
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
/***** User's photo *****/ /***** User's photo *****/
HTM_TD_Begin ("rowspan=\"3\" class=\"REC_C3_TOP CT\""); HTM_TD_Begin ("rowspan=\"3\" class=\"REC_C3_TOP CT\"");
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO186x248",Pho_ZOOM,false);
NULL,
"PHOTO186x248",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
} }

View File

@ -1742,8 +1742,6 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType,
struct Sta_Hits Hits; struct Sta_Hits Hits;
unsigned BarWidth; unsigned BarWidth;
struct UsrData UsrDat; struct UsrData UsrDat;
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
/***** Initialize user's data *****/ /***** Initialize user's data *****/
Usr_UsrDataConstructor (&UsrDat); Usr_UsrDataConstructor (&UsrDat);
@ -1780,10 +1778,7 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType,
/* Show the photo */ /* Show the photo */
HTM_TD_Begin ("class=\"CT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"CT COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO15x20",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO15x20",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/* Write the user's ID if user is a student in current course */ /* Write the user's ID if user is a student in current course */

View File

@ -2384,8 +2384,6 @@ void TstPrn_ShowOnePrint (void)
extern const char *Txt_Grade; extern const char *Txt_Grade;
extern const char *Txt_Tags; extern const char *Txt_Tags;
struct TstPrn_Print Print; struct TstPrn_Print Print;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
Dat_StartEndTime_t StartEndTime; Dat_StartEndTime_t StartEndTime;
char *Id; char *Id;
struct TstRes_ICanView ICanView; struct TstRes_ICanView ICanView;
@ -2442,10 +2440,7 @@ void TstPrn_ShowOnePrint (void)
if (Gbl.Usrs.Other.UsrDat.FrstName[0]) if (Gbl.Usrs.Other.UsrDat.FrstName[0])
HTM_TxtF (", %s",Gbl.Usrs.Other.UsrDat.FrstName); HTM_TxtF (", %s",Gbl.Usrs.Other.UsrDat.FrstName);
HTM_BR (); HTM_BR ();
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,"PHOTO45x60",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO45x60",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -181,18 +181,12 @@ void TL_Com_PutPhotoAndFormToWriteNewComm (const struct TL_Timeline *Timeline,
static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat) static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat)
{ {
bool ShowPhoto = false;
char PhotoURL[PATH_MAX + 1];
/***** Show author's photo *****/ /***** Show author's photo *****/
/* Begin container */ /* Begin container */
HTM_DIV_Begin ("class=\"TL_COM_PHOTO\""); HTM_DIV_Begin ("class=\"TL_COM_PHOTO\"");
/* Author's photo */ /* Author's photo */
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO30x40",Pho_ZOOM,true); // Use unique id
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO30x40",Pho_ZOOM,true); // Use unique id
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();

View File

@ -310,18 +310,12 @@ static void TL_Not_WriteNote (const struct TL_Timeline *Timeline,
static void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat) static void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat)
{ {
bool ShowPhoto = false;
char PhotoURL[PATH_MAX + 1];
/***** Show author's photo *****/ /***** Show author's photo *****/
/* Begin container */ /* Begin container */
HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\""); HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\"");
/* Photo */ /* Photo */
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,true); // Use unique id
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO45x60",Pho_ZOOM,true); // Use unique id
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();

View File

@ -122,8 +122,6 @@ void TL_Pst_GetAndWritePost (long PstCod)
void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline) void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline)
{ {
extern const char *Txt_New_TIMELINE_post; extern const char *Txt_New_TIMELINE_post;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
/***** Begin list *****/ /***** Begin list *****/
HTM_UL_Begin ("class=\"TL_LIST\""); HTM_UL_Begin ("class=\"TL_LIST\"");
@ -136,10 +134,7 @@ void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline)
HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\""); HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\"");
/* Author's photo */ /* Author's photo */
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Me.UsrDat,"PHOTO45x60",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO45x60",Pho_ZOOM,false);
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();

View File

@ -125,8 +125,6 @@ void TL_Usr_ShowSharersOrFavers (MYSQL_RES **mysql_res,
unsigned NumUsr; unsigned NumUsr;
unsigned NumUsrsShown = 0; unsigned NumUsrsShown = 0;
struct UsrData UsrDat; struct UsrData UsrDat;
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
if (NumUsrs) if (NumUsrs)
{ {
@ -155,10 +153,7 @@ void TL_Usr_ShowSharersOrFavers (MYSQL_RES **mysql_res,
HTM_DIV_Begin ("class=\"TL_SHARER\""); HTM_DIV_Begin ("class=\"TL_SHARER\"");
/* User's photo */ /* User's photo */
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO12x16",Pho_ZOOM,true); // Use unique id
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO12x16",Pho_ZOOM,true); // Use unique id
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();

View File

@ -2736,8 +2736,6 @@ void Usr_WriteLoggedUsrHead (void)
extern const char *The_ClassUsr[The_NUM_THEMES]; extern const char *The_ClassUsr[The_NUM_THEMES];
extern const char *Txt_Role; extern const char *Txt_Role;
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
unsigned NumAvailableRoles = Rol_GetNumAvailableRoles (); unsigned NumAvailableRoles = Rol_GetNumAvailableRoles ();
HTM_DIV_Begin ("class=\"HEAD_USR %s\"",The_ClassUsr[Gbl.Prefs.Theme]); HTM_DIV_Begin ("class=\"HEAD_USR %s\"",The_ClassUsr[Gbl.Prefs.Theme]);
@ -2762,10 +2760,7 @@ void Usr_WriteLoggedUsrHead (void)
HTM_NBSP (); HTM_NBSP ();
/***** Show my photo *****/ /***** Show my photo *****/
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Me.UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Me.UsrDat,"PHOTO18x24",Pho_ZOOM,false);
Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO18x24",Pho_ZOOM,false);
/***** User's name *****/ /***** User's name *****/
if (Gbl.Usrs.Me.UsrDat.FrstName[0]) if (Gbl.Usrs.Me.UsrDat.FrstName[0])
@ -3558,8 +3553,6 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
extern const char *Txt_Enrolment_confirmed; extern const char *Txt_Enrolment_confirmed;
extern const char *Txt_Enrolment_not_confirmed; extern const char *Txt_Enrolment_not_confirmed;
char BgColor[Usr_MAX_BYTES_BG_COLOR + 1]; char BgColor[Usr_MAX_BYTES_BG_COLOR + 1];
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
bool UsrIsTheMsgSender = PutCheckBoxToSelectUsr && bool UsrIsTheMsgSender = PutCheckBoxToSelectUsr &&
(UsrDat->UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); (UsrDat->UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
struct Ins_Instit Ins; struct Ins_Instit Ins;
@ -3567,73 +3560,71 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
/***** Start row *****/ /***** Start row *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/***** Checkbox to select user *****/ /***** Checkbox to select user *****/
// Two colors are used alternatively to better distinguish the rows // Two colors are used alternatively to better distinguish the rows
if (UsrIsTheMsgSender) if (UsrIsTheMsgSender)
Str_Copy (BgColor,"LIGHT_GREEN",sizeof (BgColor) - 1); Str_Copy (BgColor,"LIGHT_GREEN",sizeof (BgColor) - 1);
else else
snprintf (BgColor,sizeof (BgColor),"COLOR%u",Gbl.RowEvenOdd); snprintf (BgColor,sizeof (BgColor),"COLOR%u",Gbl.RowEvenOdd);
if (PutCheckBoxToSelectUsr) if (PutCheckBoxToSelectUsr)
{ {
HTM_TD_Begin ("class=\"CM %s\"",BgColor); HTM_TD_Begin ("class=\"CM %s\"",BgColor);
Usr_PutCheckboxToSelectUser (Role,UsrDat->EnUsrCod,UsrIsTheMsgSender, Usr_PutCheckboxToSelectUser (Role,UsrDat->EnUsrCod,UsrIsTheMsgSender,
SelectedUsrs); SelectedUsrs);
HTM_TD_End ();
}
/***** User has accepted enrolment? *****/
if (UsrIsTheMsgSender)
HTM_TD_Begin ("class=\"BM_SEL %s\" title=\"%s\"",
UsrDat->Accepted ? "USR_LIST_NUM_N" :
"USR_LIST_NUM",
UsrDat->Accepted ? Txt_Enrolment_confirmed :
Txt_Enrolment_not_confirmed);
else
HTM_TD_Begin ("class=\"BM%u %s\" title=\"%s\"",
Gbl.RowEvenOdd,
UsrDat->Accepted ? "USR_LIST_NUM_N" :
"USR_LIST_NUM",
UsrDat->Accepted ? Txt_Enrolment_confirmed :
Txt_Enrolment_not_confirmed);
HTM_Txt (UsrDat->Accepted ? "&check;" :
"&cross;");
HTM_TD_End (); HTM_TD_End ();
}
/***** User has accepted enrolment? *****/ /***** Write number of user in the list *****/
if (UsrIsTheMsgSender) HTM_TD_Begin ("class=\"%s RM %s\"",
HTM_TD_Begin ("class=\"BM_SEL %s\" title=\"%s\"",
UsrDat->Accepted ? "USR_LIST_NUM_N" : UsrDat->Accepted ? "USR_LIST_NUM_N" :
"USR_LIST_NUM", "USR_LIST_NUM",
UsrDat->Accepted ? Txt_Enrolment_confirmed : BgColor);
Txt_Enrolment_not_confirmed); HTM_Unsigned (NumUsr);
else
HTM_TD_Begin ("class=\"BM%u %s\" title=\"%s\"",
Gbl.RowEvenOdd,
UsrDat->Accepted ? "USR_LIST_NUM_N" :
"USR_LIST_NUM",
UsrDat->Accepted ? Txt_Enrolment_confirmed :
Txt_Enrolment_not_confirmed);
HTM_Txt (UsrDat->Accepted ? "&check;" :
"&cross;");
HTM_TD_End ();
/***** Write number of user in the list *****/
HTM_TD_Begin ("class=\"%s RM %s\"",
UsrDat->Accepted ? "USR_LIST_NUM_N" :
"USR_LIST_NUM",
BgColor);
HTM_Unsigned (NumUsr);
HTM_TD_End ();
if (Gbl.Usrs.Listing.WithPhotos)
{
/***** Show user's photo *****/
HTM_TD_Begin ("class=\"CM %s\"",BgColor);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
}
/****** Write user's IDs ******/ if (Gbl.Usrs.Listing.WithPhotos)
HTM_TD_Begin ("class=\"%s LM %s\"", {
UsrDat->Accepted ? "DAT_SMALL_N" : /***** Show user's photo *****/
"DAT_SMALL", HTM_TD_Begin ("class=\"CM %s\"",BgColor);
BgColor); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false);
ID_WriteUsrIDs (UsrDat,NULL); HTM_TD_End ();
HTM_TD_End (); }
/***** Write rest of main user's data *****/ /****** Write user's IDs ******/
Ins.InsCod = UsrDat->InsCod; HTM_TD_Begin ("class=\"%s LM %s\"",
Ins_GetDataOfInstitutionByCod (&Ins); UsrDat->Accepted ? "DAT_SMALL_N" :
Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor); "DAT_SMALL",
HTM_TD_Begin ("class=\"LM %s\"",BgColor); BgColor);
Ins_DrawInstitutionLogoWithLink (&Ins,25); ID_WriteUsrIDs (UsrDat,NULL);
HTM_TD_End (); HTM_TD_End ();
/***** Write rest of main user's data *****/
Ins.InsCod = UsrDat->InsCod;
Ins_GetDataOfInstitutionByCod (&Ins);
Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor);
HTM_TD_Begin ("class=\"LM %s\"",BgColor);
Ins_DrawInstitutionLogoWithLink (&Ins,25);
HTM_TD_End ();
/***** End row *****/ /***** End row *****/
HTM_TR_End (); HTM_TR_End ();
@ -3645,8 +3636,6 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
static void Usr_WriteRowGstAllData (struct UsrData *UsrDat) static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
{ {
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
struct Ins_Instit Ins; struct Ins_Instit Ins;
struct Ctr_Centre Ctr; struct Ctr_Centre Ctr;
struct Dpt_Department Dpt; struct Dpt_Department Dpt;
@ -3654,71 +3643,68 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
/***** Start row *****/ /***** Start row *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
if (Gbl.Usrs.Listing.WithPhotos) if (Gbl.Usrs.Listing.WithPhotos)
{ {
/***** Show guest's photo *****/ /***** Show guest's photo *****/
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_NO_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL : HTM_TD_End ();
NULL, }
"PHOTO21x28",Pho_NO_ZOOM,false);
/****** Write user's ID ******/
HTM_TD_Begin ("class=\"DAT_SMALL LM COLOR%u\"",Gbl.RowEvenOdd);
ID_WriteUsrIDs (UsrDat,NULL);
HTM_NBSP ();
HTM_TD_End (); HTM_TD_End ();
}
/****** Write user's ID ******/ /***** Write rest of guest's main data *****/
HTM_TD_Begin ("class=\"DAT_SMALL LM COLOR%u\"",Gbl.RowEvenOdd); Ins.InsCod = UsrDat->InsCod;
ID_WriteUsrIDs (UsrDat,NULL); Ins_GetDataOfInstitutionByCod (&Ins);
HTM_NBSP (); Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd]);
HTM_TD_End (); Usr_WriteEmail (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd]);
Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
Ins.FullName,
NULL,true,false);
/***** Write rest of guest's main data *****/ /***** Write the rest of the data of the guest *****/
Ins.InsCod = UsrDat->InsCod; if (UsrDat->Tch.CtrCod > 0)
Ins_GetDataOfInstitutionByCod (&Ins); {
Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd]); Ctr.CtrCod = UsrDat->Tch.CtrCod;
Usr_WriteEmail (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd]); Ctr_GetDataOfCentreByCod (&Ctr);
Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd], }
Ins.FullName, Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
NULL,true,false); UsrDat->Tch.CtrCod > 0 ? Ctr.FullName :
"&nbsp;",
/***** Write the rest of the data of the guest *****/ NULL,true,false);
if (UsrDat->Tch.CtrCod > 0) if (UsrDat->Tch.DptCod > 0)
{ {
Ctr.CtrCod = UsrDat->Tch.CtrCod; Dpt.DptCod = UsrDat->Tch.DptCod;
Ctr_GetDataOfCentreByCod (&Ctr); Dpt_GetDataOfDepartmentByCod (&Dpt);
} }
Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd], Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
UsrDat->Tch.CtrCod > 0 ? Ctr.FullName : UsrDat->Tch.DptCod > 0 ? Dpt.FullName :
"&nbsp;", "&nbsp;",
NULL,true,false); NULL,true,false);
if (UsrDat->Tch.DptCod > 0) Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
{ UsrDat->Tch.Office[0] ? UsrDat->Tch.Office :
Dpt.DptCod = UsrDat->Tch.DptCod; "&nbsp;",
Dpt_GetDataOfDepartmentByCod (&Dpt); NULL,true,false);
} Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd], UsrDat->Tch.OfficePhone[0] ? UsrDat->Tch.OfficePhone :
UsrDat->Tch.DptCod > 0 ? Dpt.FullName : "&nbsp;",
"&nbsp;", NULL,true,false);
NULL,true,false); Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd], UsrDat->Phone[0][0] ? UsrDat->Phone[0] :
UsrDat->Tch.Office[0] ? UsrDat->Tch.Office : "&nbsp;",
"&nbsp;", NULL,true,false);
NULL,true,false); Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd], UsrDat->Phone[1][0] ? UsrDat->Phone[1] :
UsrDat->Tch.OfficePhone[0] ? UsrDat->Tch.OfficePhone : "&nbsp;",
"&nbsp;", NULL,true,false);
NULL,true,false); Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd], UsrDat->StrBirthday[0] ? UsrDat->StrBirthday :
UsrDat->Phone[0][0] ? UsrDat->Phone[0] : "&nbsp;",
"&nbsp;", NULL,true,false);
NULL,true,false);
Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
UsrDat->Phone[1][0] ? UsrDat->Phone[1] :
"&nbsp;",
NULL,true,false);
Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],
UsrDat->StrBirthday[0] ? UsrDat->StrBirthday :
"&nbsp;",
NULL,true,false);
/***** End row *****/ /***** End row *****/
HTM_TR_End (); HTM_TR_End ();
@ -3730,8 +3716,6 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames) static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
{ {
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
unsigned NumGrpTyp,NumField; unsigned NumGrpTyp,NumField;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -3747,10 +3731,7 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
{ {
/***** Show student's photo *****/ /***** Show student's photo *****/
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_NO_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_NO_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -3759,8 +3740,8 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
UsrDat->Accepted ? "DAT_SMALL_N" : UsrDat->Accepted ? "DAT_SMALL_N" :
"DAT_SMALL", "DAT_SMALL",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
ID_WriteUsrIDs (UsrDat,NULL); ID_WriteUsrIDs (UsrDat,NULL);
HTM_NBSP (); HTM_NBSP ();
HTM_TD_End (); HTM_TD_End ();
/***** Write rest of main student's data *****/ /***** Write rest of main student's data *****/
@ -3834,8 +3815,6 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
static void Usr_WriteRowTchAllData (struct UsrData *UsrDat) static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
{ {
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
struct Ins_Instit Ins; struct Ins_Instit Ins;
struct Ctr_Centre Ctr; struct Ctr_Centre Ctr;
struct Dpt_Department Dpt; struct Dpt_Department Dpt;
@ -3850,10 +3829,7 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
{ {
/***** Show teacher's photo *****/ /***** Show teacher's photo *****/
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_NO_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_NO_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -3912,8 +3888,6 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
static void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat) static void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
{ {
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
struct Ins_Instit Ins; struct Ins_Instit Ins;
/***** Start row *****/ /***** Start row *****/
@ -3928,10 +3902,7 @@ static void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
{ {
/***** Show administrator's photo *****/ /***** Show administrator's photo *****/
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -8979,10 +8950,8 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
{ {
unsigned NumUsr; unsigned NumUsr;
bool TRIsOpen = false; bool TRIsOpen = false;
bool ShowPhoto;
bool UsrIsTheMsgSender; bool UsrIsTheMsgSender;
const char *ClassPhoto = "PHOTO21x28"; // Default photo size const char *ClassPhoto = "PHOTO21x28"; // Default photo size
char PhotoURL[PATH_MAX + 1];
struct UsrData UsrDat; struct UsrData UsrDat;
if (Gbl.Usrs.LstUsrs[Role].NumUsrs) if (Gbl.Usrs.LstUsrs[Role].NumUsrs)
@ -9043,10 +9012,7 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
SelectedUsrs); SelectedUsrs);
/***** Show photo *****/ /***** Show photo *****/
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (&UsrDat,ClassPhoto,Pho_ZOOM,false);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
ClassPhoto,Pho_ZOOM,false);
/***** Photo foot *****/ /***** Photo foot *****/
HTM_DIV_Begin ("class=\"CLASSPHOTO_CAPTION\""); HTM_DIV_Begin ("class=\"CLASSPHOTO_CAPTION\"");
@ -9906,8 +9872,6 @@ void Usr_WriteAuthor1Line (long UsrCod,bool Hidden)
void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows) void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows)
{ {
bool ShowPhoto;
char PhotoURL[PATH_MAX + 1];
Act_Action_t NextAction; Act_Action_t NextAction;
/***** Show user's photo *****/ /***** Show user's photo *****/
@ -9916,10 +9880,7 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows)
NumRows + 1,Gbl.RowEvenOdd); NumRows + 1,Gbl.RowEvenOdd);
else else
HTM_TD_Begin ("class=\"LT LINE_BOTTOM COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"LT LINE_BOTTOM COLOR%u\"",Gbl.RowEvenOdd);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,false);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO45x60",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/***** User's IDs and name *****/ /***** User's IDs and name *****/