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,8 +1632,6 @@ 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);
@ -1652,10 +1650,7 @@ void ExaRes_ShowExamResultUser (struct UsrData *UsrDat)
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 :
NULL,
"PHOTO45x60",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/***** Row end *****/ /***** Row end *****/

View File

@ -3369,16 +3369,11 @@ 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 *****/
@ -3421,16 +3416,17 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
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\""
" class=\"AUTHOR_TXT\"",
UsrDat->Email); UsrDat->Email);
HTM_Txt (UsrDat->Email); HTM_Txt (UsrDat->Email);
HTM_A_End (); HTM_A_End ();
} }
Frm_EndForm (); Frm_EndForm ();
HTM_DIV_End (); 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,24 +823,18 @@ 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) if (Visible)
{ {
/* Put form to go to public profile */ /* Put form to go to public profile */
@ -869,6 +863,7 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
/* Form to follow */ /* Form to follow */
Fol_PutIconToFollow (UsrDat); Fol_PutIconToFollow (UsrDat);
} }
HTM_TD_End (); HTM_TD_End ();
} }
@ -879,21 +874,15 @@ 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); HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd);
if (Visible) if (Visible)
{ Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false);
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
}
HTM_TD_End (); HTM_TD_End ();
/***** User's name *****/ /***** User's name *****/
@ -904,7 +893,8 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
Frm_BeginForm (ActSeeOthPubPrf); Frm_BeginForm (ActSeeOthPubPrf);
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
HTM_DIV_Begin ("class=\"CON_NAME_FOLLOW\""); // Limited width HTM_DIV_Begin ("class=\"CON_NAME_FOLLOW\""); // Limited width
HTM_BUTTON_SUBMIT_Begin (Txt_Another_user_s_profile,"BT_LINK CON_NAME_FOLLOW CON_CRS",NULL); HTM_BUTTON_SUBMIT_Begin (Txt_Another_user_s_profile,
"BT_LINK CON_NAME_FOLLOW CON_CRS",NULL);
Usr_WriteFirstNameBRSurnames (UsrDat); Usr_WriteFirstNameBRSurnames (UsrDat);
HTM_BUTTON_End (); HTM_BUTTON_End ();
HTM_DIV_End (); HTM_DIV_End ();
@ -929,6 +919,7 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
Fol_PutIconToFollow (UsrDat); Fol_PutIconToFollow (UsrDat);
} }
HTM_TD_End (); 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 *****/
@ -1235,10 +1233,7 @@ void MchRes_ShowOneMchResult (void)
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 :
NULL,
"PHOTO45x60",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -500,14 +500,8 @@ 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\"",
@ -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? *****/
@ -3415,14 +3407,10 @@ void Msg_WriteMsgAuthor (struct UsrData *UsrDat,bool Enabled,const char *BgColor
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);
Pho_ShowUsrPhoto (UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO30x40",Pho_ZOOM,false);
}
else else
Ico_PutIcon ("usr_bl.jpg",Txt_Unknown_or_without_photo,"PHOTO30x40"); Ico_PutIcon ("usr_bl.jpg",Txt_Unknown_or_without_photo,"PHOTO30x40");
HTM_TD_End (); HTM_TD_End ();
/***** Second column with user name (if author has a web page, put a link to it) *****/ /***** Second column with user name (if author has a web page, put a link to it) *****/
@ -3555,8 +3543,6 @@ 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);
@ -3572,10 +3558,7 @@ static void Msg_WriteMsgFrom (struct Msg_Messages *Messages,
/***** 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 :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
HTM_TD_End (); HTM_TD_End ();
/***** Write user's name *****/ /***** Write user's name *****/
@ -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,8 +1756,6 @@ 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\"",
@ -1770,13 +1768,8 @@ static void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank,bool ItsM
/***** 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 *****/
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (UsrDat,PhotoURL); Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO30x40",Pho_ZOOM,false);
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 *****/

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;
@ -3612,10 +3605,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
{ {
/***** Show user's photo *****/ /***** Show user's photo *****/
HTM_TD_Begin ("class=\"CM %s\"",BgColor); HTM_TD_Begin ("class=\"CM %s\"",BgColor);
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 ();
} }
@ -3631,6 +3621,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
Ins.InsCod = UsrDat->InsCod; Ins.InsCod = UsrDat->InsCod;
Ins_GetDataOfInstitutionByCod (&Ins); Ins_GetDataOfInstitutionByCod (&Ins);
Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor); Usr_WriteMainUsrDataExceptUsrID (UsrDat,BgColor);
HTM_TD_Begin ("class=\"LM %s\"",BgColor); HTM_TD_Begin ("class=\"LM %s\"",BgColor);
Ins_DrawInstitutionLogoWithLink (&Ins,25); Ins_DrawInstitutionLogoWithLink (&Ins,25);
HTM_TD_End (); HTM_TD_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;
@ -3658,10 +3647,7 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
{ {
/***** 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 :
NULL,
"PHOTO21x28",Pho_NO_ZOOM,false);
HTM_TD_End (); HTM_TD_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 ();
} }
@ -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 *****/