Version 21.65: Dec 01, 2021 Selection of shape of user photos.

This commit is contained in:
acanas 2021-12-01 01:43:13 +01:00
parent d2988d8895
commit 15607b19e5
99 changed files with 2284 additions and 1556 deletions

View File

@ -2120,16 +2120,36 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
} }
/******************************* User's photo ********************************/ /******************************* User's photo ********************************/
.PHOTO12x16 {width: 12px; height: 16px; border-radius:1px; vertical-align:middle; margin-top:-2px;} .PHOTOC12x16 {width: 12px; height: 16px; clip-path: circle(50% at center); vertical-align:middle; margin-top:-2px;}
.PHOTO15x20 {width: 15px; height: 20px; border-radius:1px; vertical-align:middle;} .PHOTOC15x20 {width: 15px; height: 20px; clip-path: circle(50% at center); vertical-align:middle;}
.PHOTO15x20B {width: 15px; height: 20px; border-radius:1px; vertical-align:middle; display:block; margin:0 auto;} .PHOTOC15x20B {width: 15px; height: 20px; clip-path: circle(50% at center); vertical-align:middle; display:block; margin:0 auto;}
.PHOTO18x24 {width: 18px; height: 24px; border-radius:2px; vertical-align:middle;} .PHOTOC18x24 {width: 18px; height: 24px; clip-path: circle(50% at center); vertical-align:middle;}
.PHOTO21x28 {width: 21px; height: 28px; border-radius:2px; vertical-align:middle;} .PHOTOC21x28 {width: 21px; height: 28px; clip-path: circle(50% at center); vertical-align:middle;}
.PHOTO30x40 {width: 30px; height: 40px; border-radius:2px; vertical-align:middle;} .PHOTOC30x40 {width: 30px; height: 40px; clip-path: circle(50% at center); vertical-align:middle;}
.PHOTO42x56 {width: 42px; height: 56px; border-radius:3px; vertical-align:middle;} .PHOTOC45x60 {width: 45px; height: 60px; clip-path: circle(50% at center); vertical-align:middle;}
.PHOTO45x60 {width: 45px; height: 60px; border-radius:3px; vertical-align:middle;} .PHOTOC60x80 {width: 60px; height: 80px; clip-path: circle(50% at center); vertical-align:middle;}
.PHOTO60x80 {width: 60px; height: 80px; border-radius:3px; vertical-align:middle;} .PHOTOC186x248 {width:186px; height:248px; clip-path: circle(50% at center); vertical-align:middle;}
.PHOTO186x248 {width:186px; height:248px; border-radius:4px; vertical-align:middle;}
.PHOTOE12x16 {width: 12px; height: 16px; clip-path: ellipse(50% 50% at center); vertical-align:middle; margin-top:-2px;}
.PHOTOE15x20 {width: 15px; height: 20px; clip-path: ellipse(50% 50% at center); vertical-align:middle;}
.PHOTOE15x20B {width: 15px; height: 20px; clip-path: ellipse(50% 50% at center); vertical-align:middle; display:block; margin:0 auto;}
.PHOTOE18x24 {width: 18px; height: 24px; clip-path: ellipse(50% 50% at center); vertical-align:middle;}
.PHOTOE21x28 {width: 21px; height: 28px; clip-path: ellipse(50% 50% at center); vertical-align:middle;}
.PHOTOE30x40 {width: 30px; height: 40px; clip-path: ellipse(50% 50% at center); vertical-align:middle;}
.PHOTOE45x60 {width: 45px; height: 60px; clip-path: ellipse(50% 50% at center); vertical-align:middle;}
.PHOTOE60x80 {width: 60px; height: 80px; clip-path: ellipse(50% 50% at center); vertical-align:middle;}
.PHOTOE186x248 {width:186px; height:248px; clip-path: ellipse(50% 50% at center); vertical-align:middle;}
.PHOTOR12x16 {width: 12px; height: 16px; border-radius:1px; vertical-align:middle; margin-top:-2px;}
.PHOTOR15x20 {width: 15px; height: 20px; border-radius:1px; vertical-align:middle;}
.PHOTOR15x20B {width: 15px; height: 20px; border-radius:1px; vertical-align:middle; display:block; margin:0 auto;}
.PHOTOR18x24 {width: 18px; height: 24px; border-radius:2px; vertical-align:middle;}
.PHOTOR21x28 {width: 21px; height: 28px; border-radius:2px; vertical-align:middle;}
.PHOTOR30x40 {width: 30px; height: 40px; border-radius:2px; vertical-align:middle;}
.PHOTOR45x60 {width: 45px; height: 60px; border-radius:3px; vertical-align:middle;}
.PHOTOR60x80 {width: 60px; height: 80px; border-radius:3px; vertical-align:middle;}
.PHOTOR186x248 {width:186px; height:248px; border-radius:4px; vertical-align:middle;}
.IMG_USR .IMG_USR
{ {
box-sizing:border-box; box-sizing:border-box;

View File

@ -1291,6 +1291,7 @@ CREATE TABLE IF NOT EXISTS set_ip_settings (
IconSet CHAR(16) NOT NULL, IconSet CHAR(16) NOT NULL,
Menu TINYINT NOT NULL DEFAULT 0, Menu TINYINT NOT NULL DEFAULT 0,
SideCols TINYINT NOT NULL, SideCols TINYINT NOT NULL,
UsrPhotos TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY(IP), PRIMARY KEY(IP),
INDEX(UsrCod), INDEX(UsrCod),
INDEX(LastChange)); INDEX(LastChange));
@ -1625,6 +1626,7 @@ CREATE TABLE IF NOT EXISTS usr_data (
Comments TEXT NOT NULL, Comments TEXT NOT NULL,
Menu TINYINT NOT NULL DEFAULT 0, Menu TINYINT NOT NULL DEFAULT 0,
SideCols TINYINT NOT NULL DEFAULT 3, SideCols TINYINT NOT NULL DEFAULT 3,
UsrPhotos TINYINT NOT NULL DEFAULT 0,
ThirdPartyCookies ENUM('N','Y') NOT NULL DEFAULT 'N', ThirdPartyCookies ENUM('N','Y') NOT NULL DEFAULT 'N',
NotifNtfEvents INT NOT NULL DEFAULT 0, NotifNtfEvents INT NOT NULL DEFAULT 0,
EmailNtfEvents INT NOT NULL DEFAULT 0, EmailNtfEvents INT NOT NULL DEFAULT 0,
@ -1645,6 +1647,7 @@ CREATE TABLE IF NOT EXISTS usr_data (
INDEX(CtrCod), INDEX(CtrCod),
INDEX(Menu), INDEX(Menu),
INDEX(SideCols), INDEX(SideCols),
INDEX(UsrPhotos),
INDEX(ThirdPartyCookies)); INDEX(ThirdPartyCookies));
-- --
-- Table usr_duplicated: stores informs of users possibly duplicated -- Table usr_duplicated: stores informs of users possibly duplicated

View File

@ -115,7 +115,8 @@ long Acc_DB_CreateNewUsr (const struct UsrData *UsrDat)
"CtyCod," "CtyCod,"
"LocalPhone,FamilyPhone," "LocalPhone,FamilyPhone,"
"Birthday,Comments," "Birthday,Comments,"
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)" "Menu,SideCols,UsrPhotos,"
"NotifNtfEvents,EmailNtfEvents)"
" VALUES" " VALUES"
" ('%s','%s'," " ('%s','%s',"
"'%s','%s','%s','%s'," "'%s','%s','%s','%s',"
@ -124,7 +125,8 @@ long Acc_DB_CreateNewUsr (const struct UsrData *UsrDat)
"%ld," "%ld,"
"'%s','%s'," "'%s','%s',"
"%s,'%s'," "%s,'%s',"
"%u,%u,-1,0)", "%u,%u,%u,"
"-1,0)",
UsrDat->EnUsrCod, UsrDat->EnUsrCod,
UsrDat->Password, UsrDat->Password,
UsrDat->Surname1, UsrDat->Surname1,
@ -146,7 +148,8 @@ long Acc_DB_CreateNewUsr (const struct UsrData *UsrDat)
UsrDat->Comments ? UsrDat->Comments : UsrDat->Comments ? UsrDat->Comments :
"", "",
(unsigned) Mnu_MENU_DEFAULT, (unsigned) Mnu_MENU_DEFAULT,
(unsigned) Cfg_DEFAULT_COLUMNS); (unsigned) Cfg_DEFAULT_COLUMNS,
(unsigned) Set_USR_PHOTOS_DEFAULT);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1810,6 +1810,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActChgCol ] = { 674,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Set_ChangeSideCols ,Set_EditSettings ,NULL}, [ActChgCol ] = { 674,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Set_ChangeSideCols ,Set_EditSettings ,NULL},
[ActChgIco ] = {1092,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Ico_ChangeIconSet ,Set_EditSettings ,NULL}, [ActChgIco ] = {1092,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Ico_ChangeIconSet ,Set_EditSettings ,NULL},
[ActChgMnu ] = {1243,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Mnu_ChangeMenu ,Set_EditSettings ,NULL}, [ActChgMnu ] = {1243,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Mnu_ChangeMenu ,Set_EditSettings ,NULL},
[ActChgUsrPho ] = {1917,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Set_ChangeUsrPhotos ,Set_EditSettings ,NULL},
[ActChgPriPho ] = { 774,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pho_ChangePhotoVisibility ,NULL}, [ActChgPriPho ] = { 774,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Pho_ChangePhotoVisibility ,NULL},
[ActChgBasPriPrf ] = {1404,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_ChangeBasicProfileVis ,NULL}, [ActChgBasPriPrf ] = {1404,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_ChangeBasicProfileVis ,NULL},
[ActChgExtPriPrf ] = {1765,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_ChangeExtendedProfileVis ,NULL}, [ActChgExtPriPrf ] = {1765,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_ChangeExtendedProfileVis ,NULL},
@ -3743,6 +3744,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActChgMch, // #1914 ActChgMch, // #1914
ActFixMchSco, // #1915 ActFixMchSco, // #1915
ActFixTstSco, // #1916 ActFixTstSco, // #1916
ActChgUsrPho, // #1917
}; };
/*****************************************************************************/ /*****************************************************************************/

View File

@ -65,7 +65,7 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_MAX_ACTION_COD 1916 #define Act_MAX_ACTION_COD 1917
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
@ -1726,18 +1726,19 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActChgCol (ActSeeMyUsgRep + 52) #define ActChgCol (ActSeeMyUsgRep + 52)
#define ActChgIco (ActSeeMyUsgRep + 53) #define ActChgIco (ActSeeMyUsgRep + 53)
#define ActChgMnu (ActSeeMyUsgRep + 54) #define ActChgMnu (ActSeeMyUsgRep + 54)
#define ActChgPriPho (ActSeeMyUsgRep + 55) #define ActChgUsrPho (ActSeeMyUsgRep + 55)
#define ActChgBasPriPrf (ActSeeMyUsgRep + 56) #define ActChgPriPho (ActSeeMyUsgRep + 56)
#define ActChgExtPriPrf (ActSeeMyUsgRep + 57) #define ActChgBasPriPrf (ActSeeMyUsgRep + 57)
#define ActChgCooPrf (ActSeeMyUsgRep + 58) #define ActChgExtPriPrf (ActSeeMyUsgRep + 58)
#define ActChgNtfPrf (ActSeeMyUsgRep + 59) #define ActChgCooPrf (ActSeeMyUsgRep + 59)
#define ActChgNtfPrf (ActSeeMyUsgRep + 60)
#define ActPrnUsrQR (ActSeeMyUsgRep + 60) #define ActPrnUsrQR (ActSeeMyUsgRep + 61)
#define ActPrnMyTT (ActSeeMyUsgRep + 61) #define ActPrnMyTT (ActSeeMyUsgRep + 62)
#define ActEdiTut (ActSeeMyUsgRep + 62) #define ActEdiTut (ActSeeMyUsgRep + 63)
#define ActChgTut (ActSeeMyUsgRep + 63) #define ActChgTut (ActSeeMyUsgRep + 64)
#define ActChgMyTT1stDay (ActSeeMyUsgRep + 64) #define ActChgMyTT1stDay (ActSeeMyUsgRep + 65)
#define Act_NUM_ACTIONS (ActChgMyTT1stDay + 1) #define Act_NUM_ACTIONS (ActChgMyTT1stDay + 1)

View File

@ -1680,6 +1680,12 @@ static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
struct UsrData *UsrDat, struct UsrData *UsrDat,
struct Att_Event *Event) struct Att_Event *Event)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
};
bool Present; bool Present;
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];
@ -1749,7 +1755,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -2906,6 +2914,12 @@ 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)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
unsigned NumAttEvent; unsigned NumAttEvent;
bool Present; bool Present;
unsigned NumTimesPresent; unsigned NumTimesPresent;
@ -2924,7 +2938,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -3058,6 +3074,12 @@ 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;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
unsigned NumAttEvent; unsigned NumAttEvent;
unsigned UniqueId; unsigned UniqueId;
char *Id; char *Id;
@ -3080,7 +3102,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);

View File

@ -62,12 +62,13 @@ struct ALn_Substring
struct ALn_Link struct ALn_Link
{ {
ALn_LinkType_t Type; ALn_LinkType_t Type; // URL or nickname?
struct ALn_Substring URLorNick; struct ALn_Substring URLorNick; // Link text
struct ALn_Substring NickAnchor[3]; struct ALn_Substring NickAnchor[3]; // Pointer to anchors if nick
size_t AddedLengthUntilHere; // Total length of extra HTML code added until this link (included) size_t LengthAddedUpToHere; // Total length of extra HTML code
struct ALn_Link *Prev; // added up to this link (included)
struct ALn_Link *Next; struct ALn_Link *Prev; // Pointer to previous link
struct ALn_Link *Next; // Pointer to next link
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -144,7 +145,36 @@ action="https://localhost/swad/es" method="post">
</form> </form>
*/ */
/*
______ ______ ______ ______
|______|<-- -->|______|<-- -->|______|<-- -->|______|<--- LastLink
|______| \/ |______| \/ |______| \/ |______|
|______| /\ |______| /\ |______| /\ |______|
|_NULL_| / ---|_Prev_| / ---|_Prev_| / ---|_Prev_|
|_Next_|-- |_Next_|-- |_Next_|-- |_NULL_|
1 Move forward the text after the link
2 Copy the 3rd part of the anchor
3 Move forward the link
4 Copy the 2nd part of the anchor
5 Copy the link into the anchor
6 Copy the 1st part of the anchor
Hi @admin, can I use https://openswad.org for free?
_______________________________
|H|i|_|@|a|d|m|i|n|,|_|c|a|n|...|
| | | | | | | | | | | | | | |
| | | | | | | | | \_\_\_\_\_\______________________________________1____
| | | \ \ \ \ \ \ \ \ \ \ \ \
| | | \_\_\_\_\_\_________________________3____ | | | | | |
| | | \ \ \ \ \ \ \ \ \ \ \ \ | | | | | |
| | | \_\_\_\_\_\_5____ | | | | | | | | | | | |
| | | \ \ \ \ \ \ | | | | | | | | | | | |
| | | 6 | | | | | | 4 | | | | | | 2 | | | | | |
v v v anchor#1 v v v v v v anchor#2 v v v v v v anchor#3 v v v v v v
___________________________________________________________________________
|H|i|_|<|_|_|_|_|@|a|d|m|i|n|_|_|_|_|>|@|a|d|m|i|n|<|_|_|_|_|>|,|_|c|a|n|...|
*/
void ALn_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScreen) void ALn_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScreen)
{ {
size_t TxtLength; size_t TxtLength;
@ -186,7 +216,7 @@ void ALn_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
/***** Insert links from end to start of text, /***** Insert links from end to start of text,
only if there is enough space available in text *****/ only if there is enough space available in text *****/
TxtLength = strlen (Txt); TxtLength = strlen (Txt);
if (TxtLength + LastLink->AddedLengthUntilHere <= MaxLength) if (TxtLength + LastLink->LengthAddedUpToHere <= MaxLength)
for (Link = LastLink; for (Link = LastLink;
Link; Link;
Link = Link->Prev) Link = Link->Prev)
@ -213,14 +243,14 @@ void ALn_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
to avoid overwriting source) *****/ to avoid overwriting source) *****/
PtrSrc = (Link == LastLink) ? Txt + TxtLength : PtrSrc = (Link == LastLink) ? Txt + TxtLength :
Link->Next->URLorNick.Str - 1, Link->Next->URLorNick.Str - 1,
PtrDst = PtrSrc + Link->AddedLengthUntilHere, PtrDst = PtrSrc + Link->LengthAddedUpToHere ,
Length = PtrSrc - (Link->URLorNick.Str + Link->URLorNick.Len - 1); Length = PtrSrc - (Link->URLorNick.Str + Link->URLorNick.Len - 1);
for (i = 0; for (i = 0;
i < Length; i < Length;
i++) i++)
*PtrDst-- = *PtrSrc--; *PtrDst-- = *PtrSrc--;
/***** Step 2: Copy third part of anchor *****/ /***** Step 2: Copy the third part of the anchor *****/
ALn_CopySubstring (Anchor[2],&PtrDst); ALn_CopySubstring (Anchor[2],&PtrDst);
/***** Step 3: Move forward the link (URL or nickname) /***** Step 3: Move forward the link (URL or nickname)
@ -249,15 +279,15 @@ void ALn_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScre
break; break;
} }
/***** Step 4: Copy second part of anchor *****/ /***** Step 4: Copy the second part of the anchor *****/
ALn_CopySubstring (Anchor[1],&PtrDst); ALn_CopySubstring (Anchor[1],&PtrDst);
/***** Step 5: Copy link into directive A /***** Step 5: Copy the link into the anchor
(it's mandatory to do the copy in reverse order (it's mandatory to do the copy in reverse order
to avoid overwriting source URL or nickname) *****/ to avoid overwriting source URL or nickname) *****/
ALn_CopySubstring (&Link->URLorNick,&PtrDst); ALn_CopySubstring (&Link->URLorNick,&PtrDst);
/***** Step 6: Copy first part of anchor *****/ /***** Step 6: Copy the first part of the anchor *****/
ALn_CopySubstring (Anchor[0],&PtrDst); ALn_CopySubstring (Anchor[0],&PtrDst);
} }
} }
@ -399,11 +429,11 @@ static ALn_LinkType_t ALn_CheckURL (char **PtrSrc,char PrevCh,
} }
/***** Compute number of bytes added until here *****/ /***** Compute number of bytes added until here *****/
(*Link)->AddedLengthUntilHere = (*Link)->Prev ? (*Link)->Prev->AddedLengthUntilHere : (*Link)->LengthAddedUpToHere = (*Link)->Prev ? (*Link)->Prev->LengthAddedUpToHere :
0; 0;
(*Link)->URLorNick.Len = (size_t) (PtrEnd + 1 - (*Link)->URLorNick.Str); (*Link)->URLorNick.Len = (size_t) (PtrEnd + 1 - (*Link)->URLorNick.Str);
if ((*Link)->URLorNick.Len <= MaxCharsURLOnScreen) if ((*Link)->URLorNick.Len <= MaxCharsURLOnScreen)
(*Link)->AddedLengthUntilHere += ALn_URL_ANCHOR_TOTAL_LENGTH + (*Link)->LengthAddedUpToHere += ALn_URL_ANCHOR_TOTAL_LENGTH +
(*Link)->URLorNick.Len; (*Link)->URLorNick.Len;
else // If URL is too long to be displayed ==> short it else // If URL is too long to be displayed ==> short it
{ {
@ -411,7 +441,7 @@ static ALn_LinkType_t ALn_CheckURL (char **PtrSrc,char PrevCh,
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
strncpy (Limited,(*Link)->URLorNick.Str,(*Link)->URLorNick.Len); strncpy (Limited,(*Link)->URLorNick.Str,(*Link)->URLorNick.Len);
Limited[(*Link)->URLorNick.Len] = '\0'; Limited[(*Link)->URLorNick.Len] = '\0';
(*Link)->AddedLengthUntilHere += ALn_URL_ANCHOR_TOTAL_LENGTH + (*Link)->LengthAddedUpToHere += ALn_URL_ANCHOR_TOTAL_LENGTH +
Str_LimitLengthHTMLStr (Limited,MaxCharsURLOnScreen); Str_LimitLengthHTMLStr (Limited,MaxCharsURLOnScreen);
free (Limited); free (Limited);
} }
@ -431,6 +461,12 @@ static ALn_LinkType_t ALn_CheckNickname (char **PtrSrc,char PrevCh,
struct ALn_Link **LastLink) struct ALn_Link **LastLink)
{ {
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC12x16",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE12x16",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR12x16",
};
char Ch; char Ch;
size_t Length; size_t Length;
char ParamsStr[Frm_MAX_BYTES_PARAMS_STR]; char ParamsStr[Frm_MAX_BYTES_PARAMS_STR];
@ -531,7 +567,7 @@ static ALn_LinkType_t ALn_CheckNickname (char **PtrSrc,char PrevCh,
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_BuildHTMLUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : Pho_BuildHTMLUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL, NULL,
"PHOTO12x16",Pho_ZOOM, ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
&CaptionStr, &CaptionStr,
&ImgStr); &ImgStr);
if (asprintf (&(*Link)->NickAnchor[2].Str, if (asprintf (&(*Link)->NickAnchor[2].Str,
@ -547,9 +583,9 @@ static ALn_LinkType_t ALn_CheckNickname (char **PtrSrc,char PrevCh,
Usr_UsrDataDestructor (&UsrDat); Usr_UsrDataDestructor (&UsrDat);
/***** Compute number of bytes added until here *****/ /***** Compute number of bytes added until here *****/
(*Link)->AddedLengthUntilHere = (*Link)->Prev ? (*Link)->Prev->AddedLengthUntilHere : (*Link)->LengthAddedUpToHere = (*Link)->Prev ? (*Link)->Prev->LengthAddedUpToHere :
0; 0;
(*Link)->AddedLengthUntilHere += (*Link)->NickAnchor[0].Len + (*Link)->LengthAddedUpToHere += (*Link)->NickAnchor[0].Len +
(*Link)->URLorNick.Len + (*Link)->URLorNick.Len +
(*Link)->NickAnchor[1].Len + (*Link)->NickAnchor[1].Len +
(*Link)->NickAnchor[2].Len; (*Link)->NickAnchor[2].Len;

View File

@ -3229,10 +3229,18 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
[Rol_NET] = ActSeeRecOneTch, [Rol_NET] = ActSeeRecOneTch,
[Rol_TCH] = ActSeeRecOneTch, [Rol_TCH] = ActSeeRecOneTch,
}; };
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC60x80",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE60x80",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR60x80",
};
/***** Show user's photo *****/ /***** Show user's photo *****/
HTM_TD_Begin ("class=\"OWNER_WORKS_PHOTO\""); HTM_TD_Begin ("class=\"OWNER_WORKS_PHOTO\"");
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO60x80",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],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 *****/
@ -5444,6 +5452,12 @@ static void Brw_WriteFileSizeAndDate (struct FileMetadata *FileMetadata)
static void Brw_WriteFileOrFolderPublisher (unsigned Level,long UsrCod) static void Brw_WriteFileOrFolderPublisher (unsigned Level,long UsrCod)
{ {
extern const char *Txt_Unknown_or_without_photo; extern const char *Txt_Unknown_or_without_photo;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20B",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20B",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20B",
};
bool ShowUsr = false; bool ShowUsr = false;
struct UsrData UsrDat; struct UsrData UsrDat;
@ -5463,9 +5477,12 @@ static void Brw_WriteFileOrFolderPublisher (unsigned Level,long UsrCod)
if (ShowUsr) if (ShowUsr)
/***** Show photo *****/ /***** Show photo *****/
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO15x20B",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],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,
ClassPhoto[Gbl.Prefs.UsrPhotos]);
HTM_TD_End (); HTM_TD_End ();
@ -7826,6 +7843,12 @@ void Brw_ShowFileMetadata (void)
extern const char *Txt_user[Usr_NUM_SEXS]; extern const char *Txt_user[Usr_NUM_SEXS];
extern const char *Txt_users[Usr_NUM_SEXS]; extern const char *Txt_users[Usr_NUM_SEXS];
extern const char *Txt_Save_file_properties; extern const char *Txt_Save_file_properties;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20",
};
struct FileMetadata FileMetadata; struct FileMetadata FileMetadata;
struct UsrData PublisherUsrDat; struct UsrData PublisherUsrDat;
char FileNameToShow[NAME_MAX + 1]; char FileNameToShow[NAME_MAX + 1];
@ -7989,7 +8012,9 @@ void Brw_ShowFileMetadata (void)
if (FileHasPublisher) if (FileHasPublisher)
{ {
/* Show photo */ /* Show photo */
Pho_ShowUsrPhotoIfAllowed (&PublisherUsrDat,"PHOTO15x20",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&PublisherUsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
/* Write name */ /* Write name */
HTM_NBSP (); HTM_NBSP ();

View File

@ -602,13 +602,20 @@ TODO: FIX BUG, URGENT! En las fechas como par
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo. TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
*/ */
#define Log_PLATFORM_VERSION "SWAD 21.64.1 (2021-11-28)" #define Log_PLATFORM_VERSION "SWAD 21.65 (2021-12-01)"
#define CSS_FILE "swad21.59.css" #define CSS_FILE "swad21.65.css"
#define JS_FILE "swad21.59.js" #define JS_FILE "swad21.59.js"
/* /*
TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 21.65: Dec 01, 2021 Selection of shape of user photos. (320755 lines)
4 changes necessary in database:
ALTER TABLE set_ip_settings ADD COLUMN UsrPhotos TINYINT NOT NULL DEFAULT 0 AFTER SideCols;
UPDATE set_ip_settings SET UsrPhotos=2;
ALTER TABLE usr_data ADD COLUMN UsrPhotos TINYINT NOT NULL DEFAULT 0 AFTER SideCols,ADD INDEX (UsrPhotos);
UPDATE usr_data SET UsrPhotos=2;
Version 21.64.1: Nov 28, 2021 Code refactoring in link insertion. (320070 lines) Version 21.64.1: Nov 28, 2021 Code refactoring in link insertion. (320070 lines)
Version 21.64: Nov 28, 2021 New module swad_autolink to insert links in texts. (320076 lines) Version 21.64: Nov 28, 2021 New module swad_autolink to insert links in texts. (320076 lines)
Version 21.63: Nov 26, 2021 Fixing of corruption in test prints and match prints. (320010 lines) Version 21.63: Nov 26, 2021 Fixing of corruption in test prints and match prints. (320010 lines)

View File

@ -556,6 +556,12 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
[Rol_NET] = ActSeeRecOneTch, [Rol_NET] = ActSeeRecOneTch,
[Rol_TCH] = ActSeeRecOneTch, [Rol_TCH] = ActSeeRecOneTch,
}; };
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
const char *ClassTxt; const char *ClassTxt;
const char *ClassLink; const char *ClassLink;
long UsrCod; long UsrCod;
@ -587,7 +593,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,true); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
true);
HTM_TD_End (); HTM_TD_End ();
/***** Write full name and link *****/ /***** Write full name and link *****/
@ -649,6 +657,12 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
[Rol_NET] = ActSeeRecOneTch, [Rol_NET] = ActSeeRecOneTch,
[Rol_TCH] = ActSeeRecOneTch, [Rol_TCH] = ActSeeRecOneTch,
}; };
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumUsrs = 0; // Initialized to avoid warning unsigned NumUsrs = 0; // Initialized to avoid warning
@ -695,7 +709,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
/***** Write full name and link *****/ /***** Write full name and link *****/

View File

@ -2689,20 +2689,21 @@ mysql> DESCRIBE ses_sessions;
/***** Table set_ip_settings *****/ /***** Table set_ip_settings *****/
/* /*
mysql> DESCRIBE set_ip_settings; mysql> DESCRIBE set_ip_settings;
+----------------+------------+------+-----+---------+-------+ +----------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra | | Field | Type | Null | Key | Default | Extra |
+----------------+------------+------+-----+---------+-------+ +----------------+----------+------+-----+---------+-------+
| IP | char(15) | NO | PRI | NULL | | | IP | char(15) | NO | PRI | NULL | |
| UsrCod | int(11) | NO | MUL | -1 | | | UsrCod | int | NO | MUL | -1 | |
| LastChange | datetime | NO | MUL | NULL | | | LastChange | datetime | NO | MUL | NULL | |
| FirstDayOfWeek | tinyint(4) | NO | | 0 | | | FirstDayOfWeek | tinyint | NO | | 0 | |
| DateFormat | tinyint(4) | NO | | 0 | | | DateFormat | tinyint | NO | | 0 | |
| Theme | char(16) | NO | | NULL | | | Theme | char(16) | NO | | NULL | |
| IconSet | char(16) | NO | | NULL | | | IconSet | char(16) | NO | | NULL | |
| Menu | tinyint(4) | NO | | 0 | | | Menu | tinyint | NO | | 0 | |
| SideCols | tinyint(4) | NO | | NULL | | | SideCols | tinyint | NO | | NULL | |
+----------------+------------+------+-----+---------+-------+ | UsrPhotos | tinyint | NO | | 0 | |
9 rows in set (0,00 sec) +----------------+----------+------+-----+---------+-------+
10 rows in set (0,01 sec)
*/ */
DB_CreateTable ("CREATE TABLE IF NOT EXISTS set_ip_settings (" DB_CreateTable ("CREATE TABLE IF NOT EXISTS set_ip_settings ("
"IP CHAR(15) NOT NULL," // Cns_MAX_BYTES_IP "IP CHAR(15) NOT NULL," // Cns_MAX_BYTES_IP
@ -2714,6 +2715,7 @@ mysql> DESCRIBE set_ip_settings;
"IconSet CHAR(16) NOT NULL," // Ico_MAX_BYTES_ICON_SET_ID "IconSet CHAR(16) NOT NULL," // Ico_MAX_BYTES_ICON_SET_ID
"Menu TINYINT NOT NULL DEFAULT 0," "Menu TINYINT NOT NULL DEFAULT 0,"
"SideCols TINYINT NOT NULL," "SideCols TINYINT NOT NULL,"
"UsrPhotos TINYINT NOT NULL DEFAULT 0,"
"PRIMARY KEY (IP)," "PRIMARY KEY (IP),"
"INDEX(UsrCod)," "INDEX(UsrCod),"
"INDEX(LastChange))"); "INDEX(LastChange))");
@ -3361,7 +3363,7 @@ mysql> DESCRIBE usr_data;
+-------------------+--------------------------------------------------+------+-----+---------+----------------+ +-------------------+--------------------------------------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra | | Field | Type | Null | Key | Default | Extra |
+-------------------+--------------------------------------------------+------+-----+---------+----------------+ +-------------------+--------------------------------------------------+------+-----+---------+----------------+
| UsrCod | int(11) | NO | PRI | NULL | auto_increment | | UsrCod | int | NO | PRI | NULL | auto_increment |
| EncryptedUsrCod | char(43) | NO | UNI | | | | EncryptedUsrCod | char(43) | NO | UNI | | |
| Password | char(86) | NO | | | | | Password | char(86) | NO | | | |
| Surname1 | varchar(511) | NO | | | | | Surname1 | varchar(511) | NO | | | |
@ -3371,17 +3373,17 @@ mysql> DESCRIBE usr_data;
| Theme | char(16) | NO | MUL | | | | Theme | char(16) | NO | MUL | | |
| IconSet | char(16) | NO | MUL | | | | IconSet | char(16) | NO | MUL | | |
| Language | char(2) | NO | MUL | | | | Language | char(2) | NO | MUL | | |
| FirstDayOfWeek | tinyint(4) | NO | MUL | 0 | | | FirstDayOfWeek | tinyint | NO | MUL | 0 | |
| DateFormat | tinyint(4) | NO | MUL | 0 | | | DateFormat | tinyint | NO | MUL | 0 | |
| Photo | char(43) | NO | | | | | Photo | char(43) | NO | | | |
| PhotoVisibility | enum('unknown','user','course','system','world') | NO | MUL | unknown | | | PhotoVisibility | enum('unknown','user','course','system','world') | NO | MUL | unknown | |
| BaPrfVisibility | enum('unknown','user','course','system','world') | NO | MUL | unknown | | | BaPrfVisibility | enum('unknown','user','course','system','world') | NO | MUL | unknown | |
| ExPrfVisibility | enum('unknown','user','course','system','world') | NO | MUL | unknown | | | ExPrfVisibility | enum('unknown','user','course','system','world') | NO | MUL | unknown | |
| CtyCod | int(11) | NO | MUL | -1 | | | CtyCod | int | NO | MUL | -1 | |
| InsCtyCod | int(11) | NO | MUL | -1 | | | InsCtyCod | int | NO | MUL | -1 | |
| InsCod | int(11) | NO | MUL | -1 | | | InsCod | int | NO | MUL | -1 | |
| DptCod | int(11) | NO | MUL | -1 | | | DptCod | int | NO | MUL | -1 | |
| CtrCod | int(11) | NO | MUL | -1 | | | CtrCod | int | NO | MUL | -1 | |
| Office | varchar(2047) | NO | | | | | Office | varchar(2047) | NO | | | |
| OfficePhone | char(16) | NO | | | | | OfficePhone | char(16) | NO | | | |
| LocalAddress | varchar(2047) | NO | | | | | LocalAddress | varchar(2047) | NO | | | |
@ -3391,13 +3393,14 @@ mysql> DESCRIBE usr_data;
| OriginPlace | varchar(2047) | NO | | | | | OriginPlace | varchar(2047) | NO | | | |
| Birthday | date | YES | | NULL | | | Birthday | date | YES | | NULL | |
| Comments | text | NO | | NULL | | | Comments | text | NO | | NULL | |
| Menu | tinyint(4) | NO | MUL | 0 | | | Menu | tinyint | NO | MUL | 0 | |
| SideCols | tinyint(4) | NO | MUL | 3 | | | SideCols | tinyint | NO | MUL | 3 | |
| UsrPhotos | tinyint | NO | MUL | 0 | |
| ThirdPartyCookies | enum('N','Y') | NO | MUL | N | | | ThirdPartyCookies | enum('N','Y') | NO | MUL | N | |
| NotifNtfEvents | int(11) | NO | | 0 | | | NotifNtfEvents | int | NO | | 0 | |
| EmailNtfEvents | int(11) | NO | | 0 | | | EmailNtfEvents | int | NO | | 0 | |
+-------------------+--------------------------------------------------+------+-----+---------+----------------+ +-------------------+--------------------------------------------------+------+-----+---------+----------------+
35 rows in set (0.00 sec) 36 rows in set (0,00 sec)
*/ */
DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_data (" DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_data ("
"UsrCod INT NOT NULL AUTO_INCREMENT," "UsrCod INT NOT NULL AUTO_INCREMENT,"
@ -3432,6 +3435,7 @@ mysql> DESCRIBE usr_data;
"Comments TEXT NOT NULL," // Cns_MAX_BYTES_TEXT "Comments TEXT NOT NULL," // Cns_MAX_BYTES_TEXT
"Menu TINYINT NOT NULL DEFAULT 0," "Menu TINYINT NOT NULL DEFAULT 0,"
"SideCols TINYINT NOT NULL DEFAULT 3," "SideCols TINYINT NOT NULL DEFAULT 3,"
"UsrPhotos TINYINT NOT NULL DEFAULT 0,"
"ThirdPartyCookies ENUM('N','Y') NOT NULL DEFAULT 'N'," "ThirdPartyCookies ENUM('N','Y') NOT NULL DEFAULT 'N',"
"NotifNtfEvents INT NOT NULL DEFAULT 0," "NotifNtfEvents INT NOT NULL DEFAULT 0,"
"EmailNtfEvents INT NOT NULL DEFAULT 0," "EmailNtfEvents INT NOT NULL DEFAULT 0,"
@ -3452,6 +3456,7 @@ mysql> DESCRIBE usr_data;
"INDEX(CtrCod)," "INDEX(CtrCod),"
"INDEX(Menu)," "INDEX(Menu),"
"INDEX(SideCols)," "INDEX(SideCols),"
"INDEX(UsrPhotos),"
"INDEX(ThirdPartyCookies))"); "INDEX(ThirdPartyCookies))");
/***** Table usr_duplicated *****/ /***** Table usr_duplicated *****/

View File

@ -2074,6 +2074,12 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
extern const char *Txt_Register; extern const char *Txt_Register;
extern const char *Txt_Reject; extern const char *Txt_Reject;
extern const char *Txt_No_enrolment_requests; extern const char *Txt_No_enrolment_requests;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumReqs; unsigned NumReqs;
@ -2235,7 +2241,9 @@ 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;\"");
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
/***** User name *****/ /***** User name *****/

View File

@ -1483,6 +1483,12 @@ 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];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
};
/***** Row begin *****/ /***** Row begin *****/
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -1501,7 +1507,9 @@ 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 ();
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
/***** Row end *****/ /***** Row end *****/

View File

@ -211,6 +211,7 @@ static void Fig_GetAndShowNumUsrsPerIconSet (void);
static void Fig_GetAndShowNumUsrsPerMenu (void); static void Fig_GetAndShowNumUsrsPerMenu (void);
static void Fig_GetAndShowNumUsrsPerTheme (void); static void Fig_GetAndShowNumUsrsPerTheme (void);
static void Fig_GetAndShowNumUsrsPerSideColumns (void); static void Fig_GetAndShowNumUsrsPerSideColumns (void);
static void Fig_GetAndShowNumUsrsPerUserPhotos (void);
/*****************************************************************************/ /*****************************************************************************/
/************************** Show use of the platform *************************/ /************************** Show use of the platform *************************/
@ -371,6 +372,7 @@ void Fig_ShowFigures (void)
[Fig_MENUS ] = Fig_GetAndShowNumUsrsPerMenu, [Fig_MENUS ] = Fig_GetAndShowNumUsrsPerMenu,
[Fig_THEMES ] = Fig_GetAndShowNumUsrsPerTheme, [Fig_THEMES ] = Fig_GetAndShowNumUsrsPerTheme,
[Fig_SIDE_COLUMNS ] = Fig_GetAndShowNumUsrsPerSideColumns, [Fig_SIDE_COLUMNS ] = Fig_GetAndShowNumUsrsPerSideColumns,
[Fig_USER_PHOTOS ] = Fig_GetAndShowNumUsrsPerUserPhotos,
[Fig_PRIVACY ] = Fig_GetAndShowNumUsrsPerPrivacy, [Fig_PRIVACY ] = Fig_GetAndShowNumUsrsPerPrivacy,
[Fig_COOKIES ] = Fig_GetAndShowNumUsrsPerCookies, [Fig_COOKIES ] = Fig_GetAndShowNumUsrsPerCookies,
}; };
@ -3900,12 +3902,12 @@ static void Fig_GetAndShowNumUsrsPerSideColumns (void)
extern const char *Txt_Columns; extern const char *Txt_Columns;
extern const char *Txt_Number_of_users; extern const char *Txt_Number_of_users;
extern const char *Txt_PERCENT_of_users; extern const char *Txt_PERCENT_of_users;
extern const char *Txt_LAYOUT_SIDE_COLUMNS[4];
unsigned SideCols; unsigned SideCols;
char *SubQuery; char *SubQuery;
char *Icon; char *Icon;
unsigned NumUsrs[4]; unsigned NumUsrs[4];
unsigned NumUsrsTotal = 0; unsigned NumUsrsTotal = 0;
extern const char *Txt_LAYOUT_SIDE_COLUMNS[4];
/***** Begin box and table *****/ /***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_SIDE_COLUMNS], Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_SIDE_COLUMNS],
@ -3919,7 +3921,7 @@ static void Fig_GetAndShowNumUsrsPerSideColumns (void)
HTM_TH (1,1,"RM",Txt_PERCENT_of_users); HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
HTM_TR_End (); HTM_TR_End ();
/***** For each language... *****/ /***** For each layout of columns... *****/
for (SideCols = 0; for (SideCols = 0;
SideCols <= Lay_SHOW_BOTH_COLUMNS; SideCols <= Lay_SHOW_BOTH_COLUMNS;
SideCols++) SideCols++)
@ -3967,3 +3969,83 @@ static void Fig_GetAndShowNumUsrsPerSideColumns (void)
/***** End table and box *****/ /***** End table and box *****/
Box_BoxTableEnd (); Box_BoxTableEnd ();
} }
/*****************************************************************************/
/****** Get and show number of users who have chosen a user photo shape ******/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerUserPhotos (void)
{
extern const char *Hlp_ANALYTICS_Figures_columns;
extern const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES];
extern const char *Txt_User_photos;
extern const char *Txt_Number_of_users;
extern const char *Txt_PERCENT_of_users;
extern const char *Txt_USER_PHOTOS[Set_NUM_USR_PHOTOS];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20B",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20B",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20B",
};
Set_UsrPhotos_t UsrPhotos;
char *SubQuery;
unsigned NumUsrs[Set_NUM_USR_PHOTOS];
unsigned NumUsrsTotal = 0;
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_SIDE_COLUMNS],
NULL,NULL,
Hlp_ANALYTICS_Figures_columns,Box_NOT_CLOSABLE,2);
/***** Heading row *****/
HTM_TR_Begin (NULL);
HTM_TH (1,1,"CM",Txt_User_photos);
HTM_TH (1,1,"RM",Txt_Number_of_users);
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
HTM_TR_End ();
/***** For each user photo shape... *****/
for (UsrPhotos = (Set_UsrPhotos_t) 0;
UsrPhotos <= (Set_UsrPhotos_t) (Set_NUM_USR_PHOTOS - 1);
UsrPhotos++)
{
/* Get the number of users who have chosen this layout of columns from database */
if (asprintf (&SubQuery,"usr_data.UsrPhotos=%u",
(unsigned) UsrPhotos) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[UsrPhotos] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
/* Update total number of users */
NumUsrsTotal += NumUsrs[UsrPhotos];
}
/***** Write number of users who have chosen this user photo shape *****/
for (UsrPhotos = (Set_UsrPhotos_t) 0;
UsrPhotos <= (Set_UsrPhotos_t) (Set_NUM_USR_PHOTOS - 1);
UsrPhotos++)
{
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"CM\"");
HTM_IMG (Cfg_URL_ICON_PUBLIC,"user.svg",Txt_USER_PHOTOS[UsrPhotos],
"class=\"%s\"",ClassPhoto[UsrPhotos]);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
HTM_Unsigned (NumUsrs[UsrPhotos]);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[UsrPhotos] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();
HTM_TR_End ();
}
/***** End table and box *****/
Box_BoxTableEnd ();
}

View File

@ -33,7 +33,7 @@
/************************** Public types and constants ***********************/ /************************** Public types and constants ***********************/
/*****************************************************************************/ /*****************************************************************************/
#define Fig_NUM_FIGURES 31 #define Fig_NUM_FIGURES 32
typedef enum typedef enum
{ {
Fig_USERS, // Number of users Fig_USERS, // Number of users
@ -65,6 +65,7 @@ typedef enum
Fig_MENUS, // Number of users per menu Fig_MENUS, // Number of users per menu
Fig_THEMES, // Number of users per theme Fig_THEMES, // Number of users per theme
Fig_SIDE_COLUMNS, // Number of users per layout of columns Fig_SIDE_COLUMNS, // Number of users per layout of columns
Fig_USER_PHOTOS, // Number of users per user photo shape
Fig_PRIVACY, // Number of users per privacity Fig_PRIVACY, // Number of users per privacity
Fig_COOKIES, // Number of users per acceptation of cookies Fig_COOKIES, // Number of users per acceptation of cookies
} Fig_FigureType_t; } Fig_FigureType_t;

View File

@ -612,12 +612,20 @@ 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;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC60x80",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE60x80",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR60x80",
};
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat); bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
/***** 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); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],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 *****/
@ -662,6 +670,12 @@ 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;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat); bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
/***** Show user's photo *****/ /***** Show user's photo *****/
@ -669,7 +683,9 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
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); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
/***** User's name *****/ /***** User's name *****/

View File

@ -2134,6 +2134,12 @@ static void For_ListForumThrs (struct For_Forums *Forums,
extern const char *Txt_Thread_with_posts_from_you; extern const char *Txt_Thread_with_posts_from_you;
extern const char *Txt_There_are_new_posts; extern const char *Txt_There_are_new_posts;
extern const char *Txt_No_new_posts; extern const char *Txt_No_new_posts;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20",
};
unsigned NumThr; unsigned NumThr;
unsigned NumThrInScreen; // From 0 to Pag_ITEMS_PER_PAGE-1 unsigned NumThrInScreen; // From 0 to Pag_ITEMS_PER_PAGE-1
struct For_Thread Thr; struct For_Thread Thr;
@ -2181,7 +2187,7 @@ static void For_ListForumThrs (struct For_Forums *Forums,
Gbl.Usrs.Me.PhotoURL[0] ? NULL : Gbl.Usrs.Me.PhotoURL[0] ? NULL :
"usr_bl.jpg", "usr_bl.jpg",
Txt_Thread_with_posts_from_you, Txt_Thread_with_posts_from_you,
"class=\"PHOTO15x20\""); "class=\"%s\"",ClassPhoto[Gbl.Prefs.UsrPhotos]);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"CONTEXT_COL %s\"",BgColor); HTM_TD_Begin ("class=\"CONTEXT_COL %s\"",BgColor);

View File

@ -145,10 +145,11 @@ struct Globals
Lan_Language_t Language; Lan_Language_t Language;
unsigned FirstDayOfWeek; unsigned FirstDayOfWeek;
Dat_Format_t DateFormat; Dat_Format_t DateFormat;
Mnu_Menu_t Menu;
unsigned SideCols;
The_Theme_t Theme;
Ico_IconSet_t IconSet; Ico_IconSet_t IconSet;
Mnu_Menu_t Menu;
The_Theme_t Theme;
unsigned SideCols;
Set_UsrPhotos_t UsrPhotos;
char URLTheme[PATH_MAX + 1]; char URLTheme[PATH_MAX + 1];
char URLIconSet[PATH_MAX + 1]; char URLIconSet[PATH_MAX + 1];
} Prefs; } Prefs;

View File

@ -4172,6 +4172,27 @@ const char *Hlp_PROFILE_Settings_columns =
"PROFILE.Settings.en#columns"; "PROFILE.Settings.en#columns";
#endif #endif
const char *Hlp_PROFILE_Settings_user_photos =
#if L==1
"PROFILE.Settings.es#fotos-de-usuarios";
#elif L==2
"PROFILE.Settings.en#user-photos";
#elif L==3
"PROFILE.Settings.en#user-photos";
#elif L==4
"PROFILE.Settings.es#fotos-de-usuarios";
#elif L==5
"PROFILE.Settings.en#user-photos";
#elif L==6
"PROFILE.Settings.es#fotos-de-usuarios";
#elif L==7
"PROFILE.Settings.en#user-photos";
#elif L==8
"PROFILE.Settings.en#user-photos";
#elif L==9
"PROFILE.Settings.en#user-photos";
#endif
const char *Hlp_PROFILE_Settings_privacy = const char *Hlp_PROFILE_Settings_privacy =
#if L==1 #if L==1
"PROFILE.Settings.es#privacidad"; "PROFILE.Settings.es#privacidad";

View File

@ -1041,6 +1041,12 @@ void MchRes_ShowOneMchResult (void)
extern const char *Txt_Score; extern const char *Txt_Score;
extern const char *Txt_Grade; extern const char *Txt_Grade;
extern const char *Txt_Tags; extern const char *Txt_Tags;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
};
struct Gam_Games Games; struct Gam_Games Games;
struct Gam_Game Game; struct Gam_Game Game;
struct Mch_Match Match; struct Mch_Match Match;
@ -1125,7 +1131,9 @@ 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 ();
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -479,8 +479,17 @@ static void Msg_PutHiddenParamsSubjectAndContent (void)
static void Msg_ShowOneUniqueRecipient (void) static void Msg_ShowOneUniqueRecipient (void)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
/***** Show user's photo *****/ /***** Show user's photo *****/
Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],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\"",
@ -2281,6 +2290,12 @@ 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;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC30x40",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE30x40",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR30x40",
};
bool WriteAuthor; bool WriteAuthor;
/***** Write author name or don't write it? *****/ /***** Write author name or don't write it? *****/
@ -2301,9 +2316,12 @@ 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); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],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,
ClassPhoto[Gbl.Prefs.UsrPhotos]);
HTM_TD_End (); HTM_TD_End ();
@ -2439,6 +2457,12 @@ 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];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
HTM_TABLE_Begin (NULL); HTM_TABLE_Begin (NULL);
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -2454,7 +2478,9 @@ 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;\"");
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
/***** Write user's name *****/ /***** Write user's name *****/
@ -2500,6 +2526,18 @@ static void Msg_WriteMsgTo (struct Msg_Messages *Messages,long MsgCod)
extern const char *Txt_and_X_other_recipients; extern const char *Txt_and_X_other_recipients;
extern const char *Txt_unknown_recipient; extern const char *Txt_unknown_recipient;
extern const char *Txt_unknown_recipients; extern const char *Txt_unknown_recipients;
static const Act_Action_t ActionSee[Msg_NUM_TYPES_OF_MSGS] =
{
[Msg_WRITING ] = ActUnk,
[Msg_RECEIVED] = ActSeeRcvMsg,
[Msg_SENT ] = ActSeeSntMsg,
};
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumRcp; unsigned NumRcp;
@ -2517,12 +2555,6 @@ static void Msg_WriteMsgTo (struct Msg_Messages *Messages,long MsgCod)
bool ShowPhoto; bool ShowPhoto;
const char *Title; const char *Title;
char PhotoURL[PATH_MAX + 1]; char PhotoURL[PATH_MAX + 1];
static const Act_Action_t ActionSee[Msg_NUM_TYPES_OF_MSGS] =
{
[Msg_WRITING ] = ActUnk,
[Msg_RECEIVED] = ActSeeRcvMsg,
[Msg_SENT ] = ActSeeSntMsg,
};
/***** Get number of recipients of a message from database *****/ /***** Get number of recipients of a message from database *****/
NumRecipients.Total = Msg_DB_GetNumRecipients (MsgCod); NumRecipients.Total = Msg_DB_GetNumRecipients (MsgCod);
@ -2587,7 +2619,8 @@ static void Msg_WriteMsgTo (struct Msg_Messages *Messages,long MsgCod)
false); false);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL, NULL,
"PHOTO21x28",Pho_ZOOM,false); ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
/* Write user's name */ /* Write user's name */
@ -2842,6 +2875,12 @@ void Msg_ListBannedUsrs (void)
extern const char *Txt_You_have_not_banned_any_sender; extern const char *Txt_You_have_not_banned_any_sender;
extern const char *Txt_Banned_users; extern const char *Txt_Banned_users;
extern const char *Txt_Sender_banned_click_to_unban_him; extern const char *Txt_Sender_banned_click_to_unban_him;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumUsr; unsigned NumUsr;
unsigned NumUsrs; unsigned NumUsrs;
@ -2883,7 +2922,9 @@ void Msg_ListBannedUsrs (void)
/* Show photo */ /* Show photo */
HTM_TD_Begin ("class=\"LM\" style=\"width:30px;\""); HTM_TD_Begin ("class=\"LM\" style=\"width:30px;\"");
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
/* Write user's full name */ /* Write user's full name */

View File

@ -421,6 +421,12 @@ void Pho_ReqRemoveMyPhoto (void)
extern const char *Txt_Do_you_really_want_to_remove_your_photo; extern const char *Txt_Do_you_really_want_to_remove_your_photo;
extern const char *Txt_Remove_photo; extern const char *Txt_Remove_photo;
extern const char *Txt_The_photo_no_longer_exists; extern const char *Txt_The_photo_no_longer_exists;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC186x248",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE186x248",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR186x248",
};
/***** Show current photo and help message *****/ /***** Show current photo and help message *****/
if (Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL)) if (Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL))
@ -431,7 +437,8 @@ void Pho_ReqRemoveMyPhoto (void)
/* Show current photo */ /* Show current photo */
Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL, Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL,
"PHOTO186x248",Pho_NO_ZOOM,false); ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
false);
/* End alert */ /* End alert */
Ale_ShowAlertAndButton2 (ActRemMyPho,NULL,NULL, Ale_ShowAlertAndButton2 (ActRemMyPho,NULL,NULL,
@ -477,7 +484,6 @@ void Pho_ReqRemoveUsrPhoto (void)
extern const char *Txt_Do_you_really_want_to_remove_the_photo_of_X; extern const char *Txt_Do_you_really_want_to_remove_the_photo_of_X;
extern const char *Txt_Remove_photo; extern const char *Txt_Remove_photo;
extern const char *Txt_The_photo_no_longer_exists; extern const char *Txt_The_photo_no_longer_exists;
char PhotoURL[PATH_MAX + 1];
static const Act_Action_t NextAction[Rol_NUM_ROLES] = static const Act_Action_t NextAction[Rol_NUM_ROLES] =
{ {
[Rol_UNK ] = ActRemOthPho, [Rol_UNK ] = ActRemOthPho,
@ -491,6 +497,13 @@ void Pho_ReqRemoveUsrPhoto (void)
[Rol_INS_ADM] = ActRemOthPho, [Rol_INS_ADM] = ActRemOthPho,
[Rol_SYS_ADM] = ActRemOthPho, [Rol_SYS_ADM] = ActRemOthPho,
}; };
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC186x248",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE186x248",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR186x248",
};
char PhotoURL[PATH_MAX + 1];
/***** Get user's code from form *****/ /***** Get user's code from form *****/
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs (); Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
@ -512,7 +525,8 @@ void Pho_ReqRemoveUsrPhoto (void)
/* Show current photo */ /* Show current photo */
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL, Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL,
"PHOTO186x248",Pho_NO_ZOOM,false); ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
false);
/* End alert */ /* End alert */
Ale_ShowAlertAndButton2 (NextAction[Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs],NULL,NULL, Ale_ShowAlertAndButton2 (NextAction[Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs],NULL,NULL,
@ -1375,7 +1389,7 @@ void Pho_ChangePhotoVisibility (void)
Pri_PHOTO_ALLOWED_VIS); Pri_PHOTO_ALLOWED_VIS);
/***** Store public/private photo in database *****/ /***** Store public/private photo in database *****/
Set_DB_UpdateMySettingsAboutPhoto (); Set_DB_UpdateMySettingsAboutPhotoVisibility ();
/***** Show form again *****/ /***** Show form again *****/
Set_EditSettings (); Set_EditSettings ();

View File

@ -1299,6 +1299,12 @@ 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;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC30x40",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE30x40",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR30x40",
};
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\"",
@ -1312,7 +1318,9 @@ static void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank,bool ItsM
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); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],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

@ -2014,13 +2014,6 @@ static void Prj_ShowOneProjectMembersWithARole (struct Prj_Projects *Projects,
extern const char *Txt_Remove; extern const char *Txt_Remove;
extern const char *Txt_Add_USERS; extern const char *Txt_Add_USERS;
extern const char *Txt_PROJECT_ROLES_PLURAL_abc[Prj_NUM_ROLES_IN_PROJECT]; extern const char *Txt_PROJECT_ROLES_PLURAL_abc[Prj_NUM_ROLES_IN_PROJECT];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
bool WriteRow;
unsigned NumUsr;
unsigned NumUsrs;
const char *ClassLabel;
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] =
{ {
[Prj_ROLE_UNK] = ActUnk, // Unknown [Prj_ROLE_UNK] = ActUnk, // Unknown
@ -2035,6 +2028,19 @@ static void Prj_ShowOneProjectMembersWithARole (struct Prj_Projects *Projects,
[Prj_ROLE_TUT] = ActReqAddTutPrj, // Tutor [Prj_ROLE_TUT] = ActReqAddTutPrj, // Tutor
[Prj_ROLE_EVL] = ActReqAddEvlPrj, // Evaluator [Prj_ROLE_EVL] = ActReqAddEvlPrj, // Evaluator
}; };
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res;
MYSQL_ROW row;
bool WriteRow;
unsigned NumUsr;
unsigned NumUsrs;
const char *ClassLabel;
const char *ClassData;
/***** Set CSS classes *****/ /***** Set CSS classes *****/
ClassLabel = (Prj->Hidden == Prj_HIDDEN) ? "ASG_LABEL_LIGHT" : ClassLabel = (Prj->Hidden == Prj_HIDDEN) ? "ASG_LABEL_LIGHT" :
@ -2128,7 +2134,9 @@ 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\"");
Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
/* Write user's name */ /* Write user's name */

View File

@ -2599,9 +2599,18 @@ static void Rec_ShowInstitutionInHead (struct Ins_Instit *Ins,bool PutFormLinks)
static void Rec_ShowPhoto (struct UsrData *UsrDat) static void Rec_ShowPhoto (struct UsrData *UsrDat)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC186x248",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE186x248",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR186x248",
};
/***** 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_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO186x248",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
} }

View File

@ -62,6 +62,9 @@ extern struct Globals Gbl;
static void Set_PutIconsToSelectSideCols (void); static void Set_PutIconsToSelectSideCols (void);
static void Set_PutIconsSideColumns (__attribute__((unused)) void *Args); static void Set_PutIconsSideColumns (__attribute__((unused)) void *Args);
static void Set_PutIconsToSelectUsrPhotos (void);
static void Set_PutIconsUsrPhotos (__attribute__((unused)) void *Args);
static void Set_GetAndUpdateUsrListType (void); static void Set_GetAndUpdateUsrListType (void);
static void Set_GetUsrListTypeFromForm (void); static void Set_GetUsrListTypeFromForm (void);
static void Set_GetMyUsrListTypeFromDB (void); static void Set_GetMyUsrListTypeFromDB (void);
@ -122,6 +125,10 @@ void Set_EditSettings (void)
Set_PutIconsToSelectSideCols (); // 7. Side columns Set_PutIconsToSelectSideCols (); // 7. Side columns
HTM_DIV_End (); HTM_DIV_End ();
HTM_DIV_Begin ("class=\"FRAME_INLINE\"");
Set_PutIconsToSelectUsrPhotos (); // 8. User photos
HTM_DIV_End ();
Box_BoxEnd (); Box_BoxEnd ();
if (Gbl.Usrs.Me.Logged) if (Gbl.Usrs.Me.Logged)
@ -176,6 +183,15 @@ void Set_GetSettingsFromIP (void)
} }
else else
Gbl.Prefs.SideCols = Cfg_DEFAULT_COLUMNS; Gbl.Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
/* Get user photo shape (row[6]) */
if (sscanf (row[6],"%u",&Gbl.Prefs.UsrPhotos) == 1)
{
if (Gbl.Prefs.UsrPhotos >= Set_NUM_USR_PHOTOS)
Gbl.Prefs.UsrPhotos = Set_USR_PHOTOS_DEFAULT;
}
else
Gbl.Prefs.UsrPhotos = Set_USR_PHOTOS_DEFAULT;
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
@ -272,6 +288,84 @@ unsigned Set_GetParamSideCols (void)
Cfg_DEFAULT_COLUMNS); Cfg_DEFAULT_COLUMNS);
} }
/*****************************************************************************/
/******************* Put icons to select user photo shape ********************/
/*****************************************************************************/
static void Set_PutIconsToSelectUsrPhotos (void)
{
extern const char *Hlp_PROFILE_Settings_user_photos;
extern const char *Txt_User_photos;
extern const char *Txt_USER_PHOTOS[Set_NUM_USR_PHOTOS];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "ICO_HIGHLIGHT PHOTOC15x20B",
[Set_USR_PHOTO_ELLIPSE ] = "ICO_HIGHLIGHT PHOTOE15x20B",
[Set_USR_PHOTO_RECTANGLE] = "ICO_HIGHLIGHT PHOTOR15x20B",
};
Set_UsrPhotos_t UsrPhotos;
Box_BoxBegin (NULL,Txt_User_photos,
Set_PutIconsUsrPhotos,NULL,
Hlp_PROFILE_Settings_user_photos,Box_NOT_CLOSABLE);
Set_BeginSettingsHead ();
Set_BeginOneSettingSelector ();
for (UsrPhotos = (Set_UsrPhotos_t) 0;
UsrPhotos <= (Set_UsrPhotos_t) (Set_NUM_USR_PHOTOS - 1);
UsrPhotos++)
{
HTM_DIV_Begin ("class=\"%s\"",UsrPhotos == Gbl.Prefs.UsrPhotos ? "PREF_ON" :
"PREF_OFF");
Frm_BeginForm (ActChgUsrPho);
Par_PutHiddenParamUnsigned (NULL,"UsrPhotos",UsrPhotos);
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user.svg",Txt_USER_PHOTOS[UsrPhotos],ClassPhoto[UsrPhotos]);
Frm_EndForm ();
HTM_DIV_End ();
}
Set_EndOneSettingSelector ();
Set_EndSettingsHead ();
Box_BoxEnd ();
}
/*****************************************************************************/
/************** Put contextual icons in side-columns setting *****************/
/*****************************************************************************/
static void Set_PutIconsUsrPhotos (__attribute__((unused)) void *Args)
{
/***** Put icon to show a figure *****/
Fig_PutIconToShowFigure (Fig_USER_PHOTOS);
}
/*****************************************************************************/
/************************** Change user photo shape **************************/
/*****************************************************************************/
void Set_ChangeUsrPhotos (void)
{
/***** Get param with user photo shape *****/
Gbl.Prefs.UsrPhotos = Set_GetParamUsrPhotos ();
/***** Store side colums in database *****/
if (Gbl.Usrs.Me.Logged)
Set_DB_UpdateMySettingsAboutUsrPhotos ();
/***** Set settings from current IP *****/
Set_SetSettingsFromIP ();
}
/*****************************************************************************/
/************** Get parameter used to change user photo shape ****************/
/*****************************************************************************/
Set_UsrPhotos_t Set_GetParamUsrPhotos (void)
{
return (Set_UsrPhotos_t) Par_GetParToUnsignedLong ("UsrPhotos",
(Set_UsrPhotos_t) 0,
(Set_UsrPhotos_t) (Set_NUM_USR_PHOTOS - 1),
Set_USR_PHOTOS_DEFAULT);
}
/*****************************************************************************/ /*****************************************************************************/
/**************** Put hidden parameters with type of list, *******************/ /**************** Put hidden parameters with type of list, *******************/
/**************** number of columns in class photo *******************/ /**************** number of columns in class photo *******************/

View File

@ -33,6 +33,16 @@
/***************************** Public constants ******************************/ /***************************** Public constants ******************************/
/*****************************************************************************/ /*****************************************************************************/
// Related with user photo shape
#define Set_NUM_USR_PHOTOS 3
typedef enum
{
Set_USR_PHOTO_CIRCLE = 0,
Set_USR_PHOTO_ELLIPSE = 1,
Set_USR_PHOTO_RECTANGLE = 2,
} Set_UsrPhotos_t;
#define Set_USR_PHOTOS_DEFAULT Set_USR_PHOTO_CIRCLE
// Related with type of list of users // Related with type of list of users
#define Set_NUM_USR_LIST_TYPES 3 #define Set_NUM_USR_LIST_TYPES 3
typedef enum typedef enum
@ -55,6 +65,9 @@ void Set_SetSettingsFromIP (void);
void Set_ChangeSideCols (void); void Set_ChangeSideCols (void);
unsigned Set_GetParamSideCols (void); unsigned Set_GetParamSideCols (void);
void Set_ChangeUsrPhotos (void);
Set_UsrPhotos_t Set_GetParamUsrPhotos (void);
//------------------------ My settings on users' list ------------------------- //------------------------ My settings on users' list -------------------------
void Set_PutParamsPrefsAboutUsrList (void); void Set_PutParamsPrefsAboutUsrList (void);
void Set_GetAndUpdatePrefsAboutUsrList (void); void Set_GetAndUpdatePrefsAboutUsrList (void);

View File

@ -145,11 +145,25 @@ void Set_DB_UpdateMySettingsAboutSideCols (void)
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/
/**************** Update user photo shape on user data table *****************/
/*****************************************************************************/
void Set_DB_UpdateMySettingsAboutUsrPhotos (void)
{
DB_QueryUPDATE ("can not update your setting about user photo shape",
"UPDATE usr_data"
" SET UsrPhotos=%u"
" WHERE UsrCod=%ld",
(unsigned) Gbl.Prefs.UsrPhotos,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
/*****************************************************************************/ /*****************************************************************************/
/***************** Update my settings about photo visibility *****************/ /***************** Update my settings about photo visibility *****************/
/*****************************************************************************/ /*****************************************************************************/
void Set_DB_UpdateMySettingsAboutPhoto (void) void Set_DB_UpdateMySettingsAboutPhotoVisibility (void)
{ {
extern const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY]; extern const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY];
@ -417,10 +431,10 @@ void Set_DB_UpdateSettingsFromIP (void)
DB_QueryREPLACE ("can not store settings from current IP address", DB_QueryREPLACE ("can not store settings from current IP address",
"REPLACE INTO set_ip_settings" "REPLACE INTO set_ip_settings"
" (IP,UsrCod,LastChange," " (IP,UsrCod,LastChange,"
"FirstDayOfWeek,DateFormat,Theme,IconSet,Menu,SideCols)" "FirstDayOfWeek,DateFormat,Theme,IconSet,Menu,SideCols,UsrPhotos)"
" VALUES" " VALUES"
" ('%s',%ld,NOW()," " ('%s',%ld,NOW(),"
"%u,%u,'%s','%s',%u,%u)", "%u,%u,'%s','%s',%u,%u,%u)",
Gbl.IP, Gbl.IP,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
Gbl.Prefs.FirstDayOfWeek, Gbl.Prefs.FirstDayOfWeek,
@ -428,7 +442,8 @@ void Set_DB_UpdateSettingsFromIP (void)
The_ThemeId[Gbl.Prefs.Theme], The_ThemeId[Gbl.Prefs.Theme],
Ico_IconSetId[Gbl.Prefs.IconSet], Ico_IconSetId[Gbl.Prefs.IconSet],
(unsigned) Gbl.Prefs.Menu, (unsigned) Gbl.Prefs.Menu,
Gbl.Prefs.SideCols); Gbl.Prefs.SideCols,
(unsigned) Gbl.Prefs.UsrPhotos);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -447,7 +462,8 @@ void Set_DB_UpdateMySettingsFromIP (void)
"Theme='%s'," "Theme='%s',"
"IconSet='%s'," "IconSet='%s',"
"Menu=%u," "Menu=%u,"
"SideCols=%u" "SideCols=%u,"
"UsrPhotos=%u"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
Gbl.Prefs.FirstDayOfWeek, Gbl.Prefs.FirstDayOfWeek,
(unsigned) Gbl.Prefs.DateFormat, (unsigned) Gbl.Prefs.DateFormat,
@ -455,6 +471,7 @@ void Set_DB_UpdateMySettingsFromIP (void)
Ico_IconSetId[Gbl.Prefs.IconSet], Ico_IconSetId[Gbl.Prefs.IconSet],
(unsigned) Gbl.Prefs.Menu, (unsigned) Gbl.Prefs.Menu,
Gbl.Prefs.SideCols, Gbl.Prefs.SideCols,
(unsigned) Gbl.Prefs.UsrPhotos,
Gbl.Usrs.Me.UsrDat.UsrCod); Gbl.Usrs.Me.UsrDat.UsrCod);
} }
@ -471,7 +488,8 @@ unsigned Set_DB_GetSettingsFromIP (MYSQL_RES **mysql_res)
"Theme," // row[2] "Theme," // row[2]
"IconSet," // row[3] "IconSet," // row[3]
"Menu," // row[4] "Menu," // row[4]
"SideCols" // row[5] "SideCols," // row[5]
"UsrPhotos" // row[6]
" FROM set_ip_settings" " FROM set_ip_settings"
" WHERE IP='%s'", " WHERE IP='%s'",
Gbl.IP); Gbl.IP);

View File

@ -35,7 +35,8 @@ void Set_DB_UpdateMySettingsAboutIconSet (const char *IconSetId);
void Set_DB_UpdateMySettingsAboutMenu (Mnu_Menu_t Menu); void Set_DB_UpdateMySettingsAboutMenu (Mnu_Menu_t Menu);
void Set_DB_UpdateMySettingsAboutTheme (const char *ThemeId); void Set_DB_UpdateMySettingsAboutTheme (const char *ThemeId);
void Set_DB_UpdateMySettingsAboutSideCols (void); void Set_DB_UpdateMySettingsAboutSideCols (void);
void Set_DB_UpdateMySettingsAboutPhoto (void); void Set_DB_UpdateMySettingsAboutUsrPhotos (void);
void Set_DB_UpdateMySettingsAboutPhotoVisibility (void);
void Set_DB_UpdateMySettingsAboutBasicProfile (void); void Set_DB_UpdateMySettingsAboutBasicProfile (void);
void Set_DB_UpdateMySettingsAboutExtendedProfile (void); void Set_DB_UpdateMySettingsAboutExtendedProfile (void);
void Set_DB_UpdateMySettingsAboutNotifyEvents (void); void Set_DB_UpdateMySettingsAboutNotifyEvents (void);

View File

@ -1306,6 +1306,12 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType,
extern const char *Txt_Role; extern const char *Txt_Role;
extern const char *Txt_STAT_TYPE_COUNT_CAPS[Sta_NUM_COUNT_TYPES]; extern const char *Txt_STAT_TYPE_COUNT_CAPS[Sta_NUM_COUNT_TYPES];
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];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20",
};
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumHit; unsigned NumHit;
struct Sta_Hits Hits; struct Sta_Hits Hits;
@ -1347,7 +1353,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO15x20",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],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

@ -2156,6 +2156,12 @@ void TstPrn_ShowOnePrint (void)
extern const char *Txt_Score; extern const char *Txt_Score;
extern const char *Txt_Grade; extern const char *Txt_Grade;
extern const char *Txt_Tags; extern const char *Txt_Tags;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
};
struct TstPrn_Print Print; struct TstPrn_Print Print;
Dat_StartEndTime_t StartEndTime; Dat_StartEndTime_t StartEndTime;
char *Id; char *Id;
@ -2216,7 +2222,9 @@ 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 ();
Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,"PHOTO45x60",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -44590,6 +44590,27 @@ const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES] =
"Kolumny" "Kolumny"
#elif L==9 // pt #elif L==9 // pt
"Colunas" "Colunas"
#endif
,
[Fig_USER_PHOTOS] =
#if L==1 // ca
"Fotos d'usuaris"
#elif L==2 // de
"Benutzerfotos"
#elif L==3 // en
"User photos"
#elif L==4 // es
"Fotos de usuarios"
#elif L==5 // fr
"Photos des utilisateurs"
#elif L==6 // gn
"Fotos de usuarios" // Okoteve traducción
#elif L==7 // it
"Foto utente"
#elif L==8 // pl
"Zdj&eogon;cia u&zdot;ytkownika "
#elif L==9 // pt
"Fotos de utilizadores"
#endif #endif
, ,
[Fig_PRIVACY] = [Fig_PRIVACY] =
@ -55557,6 +55578,90 @@ const char *Txt_User_not_found_or_you_do_not_have_permission_ =
" para realizar esta a&ccedil;&atilde;o."; " para realizar esta a&ccedil;&atilde;o.";
#endif #endif
const char *Txt_User_photos =
#if L==1 // ca
"Fotos d'usuaris";
#elif L==2 // de
"Benutzerfotos";
#elif L==3 // en
"User photos";
#elif L==4 // es
"Fotos de usuarios";
#elif L==5 // fr
"Photos des utilisateurs";
#elif L==6 // gn
"Fotos de usuarios"; // Okoteve traducción
#elif L==7 // it
"Foto utente";
#elif L==8 // pl
"Zdj&eogon;cia u&zdot;ytkownika ";
#elif L==9 // pt
"Fotos de utilizadores";
#endif
const char *Txt_USER_PHOTOS[Set_NUM_USR_PHOTOS] =
{
#if L==1 // ca
"Cercle"
#elif L==2 // de
"Kreis"
#elif L==3 // en
"Circle"
#elif L==4 // es
"C&iacute;rculo"
#elif L==5 // fr
"Cercle"
#elif L==6 // gn
"C&iacute;rculo" // Okoteve traducción
#elif L==7 // it
"Cerchio"
#elif L==8 // pl
"Ko&lstrok;o"
#elif L==9 // pt
"C&iacute;rculo"
#endif
,
#if L==1 // ca
"El&middot;lipse"
#elif L==2 // de
"Ellipse"
#elif L==3 // en
"Ellipse"
#elif L==4 // es
"Elipse"
#elif L==5 // fr
"Ellipse"
#elif L==6 // gn
"Elipse" // Okoteve traducción
#elif L==7 // it
"Ellisse"
#elif L==8 // pl
"Elipsa"
#elif L==9 // pt
"Elipse"
#endif
,
#if L==1 // ca
"Rectangle"
#elif L==2 // de
"Rechteck"
#elif L==3 // en
"Rectangle"
#elif L==4 // es
"Rect&aacute;ngulo"
#elif L==5 // fr
"Rectangle"
#elif L==6 // gn
"Rect&aacute;ngulo" // Okoteve traducción
#elif L==7 // it
"Rettangolo"
#elif L==8 // pl
"Prostok&aogon;t"
#elif L==9 // pt
"Ret&acirc;ngulo"
#endif
};
const char *Txt_Users = const char *Txt_Users =
#if L==1 // ca #if L==1 // ca
"Usuaris"; "Usuaris";

View File

@ -184,12 +184,21 @@ void Tml_Com_PutPhotoAndFormToWriteNewComm (const struct Tml_Timeline *Timeline,
static void Tml_Com_ShowAuthorPhoto (struct UsrData *UsrDat) static void Tml_Com_ShowAuthorPhoto (struct UsrData *UsrDat)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC30x40",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE30x40",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR30x40",
};
/***** Show author's photo *****/ /***** Show author's photo *****/
/* Begin container */ /* Begin container */
HTM_DIV_Begin ("class=\"Tml_COM_PHOTO\""); HTM_DIV_Begin ("class=\"Tml_COM_PHOTO\"");
/* Author's photo */ /* Author's photo */
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO30x40",Pho_ZOOM,true); // Use unique id Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
true); // Use unique id
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();

View File

@ -241,8 +241,7 @@ static void Tml_Not_WriteTopMessage (Tml_TopMessage_t TopMessage,long PublisherC
HTM_DIV_Begin ("class=\"Tml_TOP_CONT Tml_TOP_PUBLISHER Tml_WIDTH\""); HTM_DIV_Begin ("class=\"Tml_TOP_CONT Tml_TOP_PUBLISHER Tml_WIDTH\"");
/***** Show publisher's name inside form to go to user's public profile *****/ /***** Show publisher's name inside form to go to user's public profile *****/
Tml_Not_WriteAuthorName (&PublisherDat, Tml_Not_WriteAuthorName (&PublisherDat,"BT_LINK Tml_TOP_PUBLISHER");
"BT_LINK Tml_TOP_PUBLISHER");
/***** Show action made *****/ /***** Show action made *****/
HTM_TxtF (" %s:",Txt_TIMELINE_NOTE_TOP_MESSAGES[TopMessage]); HTM_TxtF (" %s:",Txt_TIMELINE_NOTE_TOP_MESSAGES[TopMessage]);
@ -290,11 +289,20 @@ static void Tml_Not_WriteNote (const struct Tml_Timeline *Timeline,
void Tml_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique) void Tml_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
};
/***** Begin container *****/ /***** Begin container *****/
HTM_DIV_Begin ("class=\"Tml_LEFT_PHOTO\""); HTM_DIV_Begin ("class=\"Tml_LEFT_PHOTO\"");
/***** Photo *****/ /***** Photo *****/
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,FormUnique); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
FormUnique);
/***** End container *****/ /***** End container *****/
HTM_DIV_End (); HTM_DIV_End ();
@ -312,7 +320,8 @@ static void Tml_Not_WriteAuthorTimeAndContent (const struct Tml_Not_Note *Not,
/***** Write author's full name *****/ /***** Write author's full name *****/
Tml_Not_WriteAuthorName (UsrDat, Tml_Not_WriteAuthorName (UsrDat,
"BT_LINK Tml_RIGHT_AUTHOR Tml_RIGHT_AUTHOR_WIDTH DAT_N_BOLD"); "BT_LINK Tml_RIGHT_AUTHOR"
" Tml_RIGHT_AUTHOR_WIDTH DAT_N_BOLD");
/***** Write date and time *****/ /***** Write date and time *****/
Tml_WriteDateTime (Not->DateTimeUTC); Tml_WriteDateTime (Not->DateTimeUTC);

View File

@ -172,7 +172,8 @@ static void Tml_Pst_PutFormToWriteNewPost (struct Tml_Timeline *Timeline)
/***** Author name *****/ /***** Author name *****/
Tml_Not_WriteAuthorName (&Gbl.Usrs.Me.UsrDat, Tml_Not_WriteAuthorName (&Gbl.Usrs.Me.UsrDat,
"BT_LINK Tml_RIGHT_AUTHOR Tml_RIGHT_AUTHOR_WIDTH DAT_N_BOLD"); "BT_LINK Tml_RIGHT_AUTHOR"
" Tml_RIGHT_AUTHOR_WIDTH DAT_N_BOLD");
/***** Form to write the post *****/ /***** Form to write the post *****/
/* Begin container */ /* Begin container */

View File

@ -179,6 +179,12 @@ static void Tml_Usr_ShowNumSharersOrFavers (unsigned NumUsrs)
static void Tml_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res, static void Tml_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res,
unsigned NumUsrs,unsigned NumFirstUsrs) unsigned NumUsrs,unsigned NumFirstUsrs)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC12x16",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE12x16",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR12x16",
};
unsigned NumUsr; unsigned NumUsr;
struct UsrData UsrDat; struct UsrData UsrDat;
@ -210,7 +216,9 @@ static void Tml_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res,
HTM_DIV_Begin ("class=\"Tml_SHARER\""); HTM_DIV_Begin ("class=\"Tml_SHARER\"");
/* User's photo */ /* User's photo */
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO12x16",Pho_ZOOM,true); // Use unique id Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
true); // Use unique id
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();

View File

@ -340,6 +340,7 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
UsrDat->Prefs.IconSet = Ico_ICON_SET_DEFAULT; UsrDat->Prefs.IconSet = Ico_ICON_SET_DEFAULT;
UsrDat->Prefs.Menu = Mnu_MENU_DEFAULT; UsrDat->Prefs.Menu = Mnu_MENU_DEFAULT;
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS; UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
UsrDat->Prefs.UsrPhotos = Set_USR_PHOTOS_DEFAULT;
UsrDat->Prefs.AcceptThirdPartyCookies = false; // By default, don't accept third party cookies UsrDat->Prefs.AcceptThirdPartyCookies = false; // By default, don't accept third party cookies
UsrDat->NtfEvents.SendEmail = 0; // By default, don't notify anything UsrDat->NtfEvents.SendEmail = 0; // By default, don't notify anything
} }
@ -592,8 +593,17 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,
else else
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS; UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
/* Get if user accepts third party cookies (row[30]) */ /* Get user settings on user photo shape (row[30]) */
UsrDat->Prefs.AcceptThirdPartyCookies = (row[30][0] == 'Y'); if (sscanf (row[30],"%u",&UsrDat->Prefs.UsrPhotos) == 1)
{
if (UsrDat->Prefs.UsrPhotos >= Set_NUM_USR_PHOTOS)
UsrDat->Prefs.UsrPhotos = Set_USR_PHOTOS_DEFAULT;
}
else
UsrDat->Prefs.UsrPhotos = Set_USR_PHOTOS_DEFAULT;
/* Get if user accepts third party cookies (row[31]) */
UsrDat->Prefs.AcceptThirdPartyCookies = (row[31][0] == 'Y');
} }
} }
else else
@ -1380,6 +1390,12 @@ 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];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC18x24",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE18x24",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR18x24",
};
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]);
@ -1404,7 +1420,9 @@ void Usr_WriteLoggedUsrHead (void)
HTM_NBSP (); HTM_NBSP ();
/***** Show my photo *****/ /***** Show my photo *****/
Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Me.UsrDat,"PHOTO18x24",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Me.UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
/***** User's name *****/ /***** User's name *****/
if (Gbl.Usrs.Me.UsrDat.FrstName[0]) if (Gbl.Usrs.Me.UsrDat.FrstName[0])
@ -2174,6 +2192,12 @@ 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;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
char BgColor[Usr_MAX_BYTES_BG_COLOR + 1]; char BgColor[Usr_MAX_BYTES_BG_COLOR + 1];
bool UsrIsTheMsgSender = PutCheckBoxToSelectUsr && bool UsrIsTheMsgSender = PutCheckBoxToSelectUsr &&
(UsrDat->UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); (UsrDat->UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
@ -2227,7 +2251,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -2258,6 +2284,12 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
static void Usr_WriteRowGstAllData (struct UsrData *UsrDat) static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
struct Ins_Instit Ins; struct Ins_Instit Ins;
struct Ctr_Center Ctr; struct Ctr_Center Ctr;
struct Dpt_Department Dpt; struct Dpt_Department Dpt;
@ -2269,7 +2301,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_NO_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -2338,6 +2372,12 @@ 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)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
unsigned NumGrpTyp,NumField; unsigned NumGrpTyp,NumField;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -2353,7 +2393,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_NO_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -2440,6 +2482,12 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
static void Usr_WriteRowTchAllData (struct UsrData *UsrDat) static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
struct Ins_Instit Ins; struct Ins_Instit Ins;
struct Ctr_Center Ctr; struct Ctr_Center Ctr;
struct Dpt_Department Dpt; struct Dpt_Department Dpt;
@ -2453,7 +2501,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_NO_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -2512,6 +2562,12 @@ 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)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
};
struct Ins_Instit Ins; struct Ins_Instit Ins;
/***** Begin row *****/ /***** Begin row *****/
@ -2526,7 +2582,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO21x28",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
} }
@ -6077,16 +6135,22 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
struct SelectedUsrs *SelectedUsrs, struct SelectedUsrs *SelectedUsrs,
bool PutCheckBoxToSelectUsr) bool PutCheckBoxToSelectUsr)
{ {
static const char *ClassPhoto[Usr_NUM_CLASS_PHOTO_TYPE][Set_NUM_USR_PHOTOS] =
{
[Usr_CLASS_PHOTO_SEL ][Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Usr_CLASS_PHOTO_SEL ][Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Usr_CLASS_PHOTO_SEL ][Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Usr_CLASS_PHOTO_SEL_SEE][Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Usr_CLASS_PHOTO_SEL_SEE][Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Usr_CLASS_PHOTO_SEL_SEE][Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
[Usr_CLASS_PHOTO_PRN ][Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Usr_CLASS_PHOTO_PRN ][Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Usr_CLASS_PHOTO_PRN ][Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
};
unsigned NumUsr; unsigned NumUsr;
bool TRIsOpen = false; bool TRIsOpen = false;
bool UsrIsTheMsgSender; bool UsrIsTheMsgSender;
struct UsrData UsrDat; struct UsrData UsrDat;
static const char *ClassPhoto[Usr_NUM_CLASS_PHOTO_TYPE] =
{
[Usr_CLASS_PHOTO_SEL ] = "PHOTO21x28",
[Usr_CLASS_PHOTO_SEL_SEE] = "PHOTO45x60",
[Usr_CLASS_PHOTO_PRN ] = "PHOTO45x60",
};
if (Gbl.Usrs.LstUsrs[Role].NumUsrs) if (Gbl.Usrs.LstUsrs[Role].NumUsrs)
{ {
@ -6132,7 +6196,7 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
SelectedUsrs); SelectedUsrs);
/***** Show photo *****/ /***** Show photo *****/
Pho_ShowUsrPhotoIfAllowed (&UsrDat,ClassPhoto[ClassPhotoType],Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (&UsrDat,ClassPhoto[ClassPhotoType][Gbl.Prefs.UsrPhotos],Pho_ZOOM,false);
/***** Photo foot *****/ /***** Photo foot *****/
HTM_DIV_Begin ("class=\"CLASSPHOTO_CAPTION\""); HTM_DIV_Begin ("class=\"CLASSPHOTO_CAPTION\"");
@ -6301,6 +6365,12 @@ unsigned Usr_GetTotalNumberOfUsers (void)
void Usr_WriteAuthor1Line (long UsrCod,bool Hidden) void Usr_WriteAuthor1Line (long UsrCod,bool Hidden)
{ {
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20",
};
bool ShowPhoto = false; bool ShowPhoto = false;
char PhotoURL[PATH_MAX + 1]; char PhotoURL[PATH_MAX + 1];
struct UsrData UsrDat; struct UsrData UsrDat;
@ -6318,7 +6388,7 @@ void Usr_WriteAuthor1Line (long UsrCod,bool Hidden)
/***** Show photo *****/ /***** Show photo *****/
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL, NULL,
"PHOTO15x20",Pho_ZOOM,false); ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,false);
/***** Write name *****/ /***** Write name *****/
HTM_DIV_Begin ("class=\"AUTHOR_1_LINE %s\"",Hidden ? "AUTHOR_TXT_LIGHT" : HTM_DIV_Begin ("class=\"AUTHOR_1_LINE %s\"",Hidden ? "AUTHOR_TXT_LIGHT" :
@ -6342,6 +6412,12 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows)
[Rol_NET] = ActSeeRecOneTch, [Rol_NET] = ActSeeRecOneTch,
[Rol_TCH] = ActSeeRecOneTch, [Rol_TCH] = ActSeeRecOneTch,
}; };
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
};
/***** Show user's photo *****/ /***** Show user's photo *****/
if (NumRows) if (NumRows)
@ -6349,7 +6425,9 @@ 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);
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO45x60",Pho_ZOOM,false); Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
false);
HTM_TD_End (); HTM_TD_End ();
/***** User's IDs and name *****/ /***** User's IDs and name *****/
@ -6419,7 +6497,7 @@ void Usr_PutWhoIcon (Usr_Who_t Who)
Gbl.Usrs.Me.PhotoURL[0] ? NULL : Gbl.Usrs.Me.PhotoURL[0] ? NULL :
"usr_bl.jpg", "usr_bl.jpg",
Txt_WHO[Who], Txt_WHO[Who],
"ICO_HIGHLIGHT PHOTO15x20"); "ICO_HIGHLIGHT PHOTOR15x20");
break; break;
case Usr_WHO_SELECTED: case Usr_WHO_SELECTED:
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"search.svg", HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"search.svg",

View File

@ -44,6 +44,7 @@
#include "swad_role_type.h" #include "swad_role_type.h"
#include "swad_scope.h" #include "swad_scope.h"
#include "swad_search.h" #include "swad_search.h"
#include "swad_setting.h"
#include "swad_string.h" #include "swad_string.h"
#include "swad_theme.h" #include "swad_theme.h"
@ -213,6 +214,7 @@ struct UsrData
Ico_IconSet_t IconSet; Ico_IconSet_t IconSet;
Mnu_Menu_t Menu; Mnu_Menu_t Menu;
unsigned SideCols; unsigned SideCols;
Set_UsrPhotos_t UsrPhotos;
bool AcceptThirdPartyCookies; // User has accepted third party cookies bool AcceptThirdPartyCookies; // User has accepted third party cookies
} Prefs; } Prefs;
}; };

View File

@ -275,7 +275,8 @@ unsigned Usr_DB_GetUsrDataFromUsrCod (MYSQL_RES **mysql_res,long UsrCod,
"IconSet," // row[27] "IconSet," // row[27]
"Menu," // row[28] "Menu," // row[28]
"SideCols," // row[29] "SideCols," // row[29]
"ThirdPartyCookies" // row[30] "UsrPhotos," // row[30]
"ThirdPartyCookies" // row[31]
" FROM usr_data" " FROM usr_data"
" WHERE UsrCod=%ld", " WHERE UsrCod=%ld",
UsrCod); UsrCod);