Version 21.66: Dec 02, 2021 New module swad_photo_shape for user photo shapes.

This commit is contained in:
acanas 2021-12-02 08:39:18 +01:00
parent 507a18cc4b
commit 05cb596913
45 changed files with 655 additions and 578 deletions

View File

@ -71,9 +71,10 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \
swad_notification.o swad_notification_database.o \
swad_pagination.o swad_parameter.o swad_password.o \
swad_password_database.o swad_photo.o swad_photo_database.o \
swad_place.o swad_place_database.o swad_plugin.o swad_plugin_database.o \
swad_privacy.o swad_profile.o swad_profile_database.o swad_program.o \
swad_program_database.o swad_project.o swad_project_database.o \
swad_photo_shape.o swad_place.o swad_place_database.o swad_plugin.o \
swad_plugin_database.o swad_privacy.o swad_profile.o \
swad_profile_database.o swad_program.o swad_program_database.o \
swad_project.o swad_project_database.o \
swad_question.o swad_question_database.o swad_question_import.o \
swad_QR.o \
swad_record.o swad_record_database.o swad_report.o \

View File

@ -13599,6 +13599,10 @@ Llama a:
ALTER TABLE set_ip_settings ADD COLUMN PhotoShape TINYINT NOT NULL DEFAULT 0 AFTER SideCols;
UPDATE set_ip_settings SET PhotoShape=3;
ALTER TABLE usr_data ADD COLUMN PhotoShape TINYINT NOT NULL DEFAULT 0 AFTER SideCols,ADD INDEX (PhotoShape);
UPDATE usr_data SET PhotoShape=3;

View File

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

View File

@ -3088,10 +3088,8 @@ int swad__getNotifications (struct soap *soap,
static int API_GetMyLanguage (struct soap *soap)
{
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
Lan_Language_t Lan;
bool UsrFound;
/***** Get user's language *****/
@ -3101,15 +3099,7 @@ static int API_GetMyLanguage (struct soap *soap)
row = mysql_fetch_row (mysql_res);
/* Get language (row[0]) */
Gbl.Prefs.Language = Lan_LANGUAGE_UNKNOWN;
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) (Lan_NUM_LANGUAGES - 1);
Lan++)
if (!strcasecmp (row[0],Lan_STR_LANG_ID[Lan]))
{
Gbl.Prefs.Language = Lan;
break;
}
Gbl.Prefs.Language = Lan_GetLanguageFromStr (row[0]);
if (Gbl.Prefs.Language == Lan_LANGUAGE_UNKNOWN) // Language stored in database is unknown
Gbl.Prefs.Language = Cfg_DEFAULT_LANGUAGE;
}
@ -3593,7 +3583,6 @@ int swad__getTests (struct soap *soap,
static int API_GetTstTags (struct soap *soap,
long CrsCod,struct swad__getTestsOutput *getTestsOut)
{
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned NumTags;

View File

@ -30,6 +30,7 @@
#include "swad_calendar.h"
#include "swad_database.h"
#include "swad_global.h"
#include "swad_photo.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
@ -115,7 +116,7 @@ long Acc_DB_CreateNewUsr (const struct UsrData *UsrDat)
"CtyCod,"
"LocalPhone,FamilyPhone,"
"Birthday,Comments,"
"Menu,SideCols,UsrPhotos,"
"Menu,SideCols,PhotoShape,"
"NotifNtfEvents,EmailNtfEvents)"
" VALUES"
" ('%s','%s',"
@ -149,7 +150,7 @@ long Acc_DB_CreateNewUsr (const struct UsrData *UsrDat)
"",
(unsigned) Mnu_MENU_DEFAULT,
(unsigned) Cfg_DEFAULT_COLUMNS,
(unsigned) Set_USR_PHOTOS_DEFAULT);
(unsigned) Pho_SHAPE_DEFAULT);
}
/*****************************************************************************/

View File

@ -1810,7 +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},
[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},
[ActChgUsrPho ] = {1917,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Set_ChangeUsrPhotos ,Set_EditSettings ,NULL},
[ActChgUsrPho ] = {1917,-1,TabUnk,ActReqEdiSet ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Pho_ChangePhotoShape ,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},
[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},

View File

@ -1680,12 +1680,12 @@ static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
struct UsrData *UsrDat,
struct Att_Event *Event)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_OVAL ] = "PHOTOO45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
[Pho_SHAPE_CIRCLE ] = "PHOTOC45x60",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE45x60",
[Pho_SHAPE_OVAL ] = "PHOTOO45x60",
[Pho_SHAPE_RECTANGLE] = "PHOTOR45x60",
};
bool Present;
char CommentStd[Cns_MAX_BYTES_TEXT + 1];
@ -1757,7 +1757,7 @@ static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
{
HTM_TD_Begin ("class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();
}
@ -2915,12 +2915,12 @@ static void Att_WriteTableHeadSeveralAttEvents (const struct Att_Events *Events)
static void Att_WriteRowUsrSeveralAttEvents (const struct Att_Events *Events,
unsigned NumUsr,struct UsrData *UsrDat)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
unsigned NumAttEvent;
bool Present;
@ -2941,7 +2941,7 @@ static void Att_WriteRowUsrSeveralAttEvents (const struct Att_Events *Events,
{
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();
}
@ -3076,12 +3076,12 @@ static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
{
extern const char *Txt_Student_comment;
extern const char *Txt_Teachers_comment;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
unsigned NumAttEvent;
unsigned UniqueId;
@ -3106,7 +3106,7 @@ static void Att_ListAttEventsForAStd (const struct Att_Events *Events,
/***** Show student's photo *****/
HTM_TD_Begin ("colspan=\"2\" class=\"RM COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -461,12 +461,12 @@ static ALn_LinkType_t ALn_CheckNickname (char **PtrSrc,char PrevCh,
struct ALn_Link **LastLink)
{
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC12x16",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE12x16",
[Set_USR_PHOTO_OVAL ] = "PHOTOO12x16",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR12x16",
[Pho_SHAPE_CIRCLE ] = "PHOTOC12x16",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE12x16",
[Pho_SHAPE_OVAL ] = "PHOTOO12x16",
[Pho_SHAPE_RECTANGLE] = "PHOTOR12x16",
};
char Ch;
size_t Length;
@ -568,7 +568,7 @@ static ALn_LinkType_t ALn_CheckNickname (char **PtrSrc,char PrevCh,
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_BuildHTMLUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
&CaptionStr,
&ImgStr);
if (asprintf (&(*Link)->NickAnchor[2].Str,

View File

@ -3229,18 +3229,18 @@ static void Brw_ShowDataOwnerAsgWrk (struct UsrData *UsrDat)
[Rol_NET] = ActSeeRecOneTch,
[Rol_TCH] = ActSeeRecOneTch,
};
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC60x80",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE60x80",
[Set_USR_PHOTO_OVAL ] = "PHOTOO60x80",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR60x80",
[Pho_SHAPE_CIRCLE ] = "PHOTOC60x80",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE60x80",
[Pho_SHAPE_OVAL ] = "PHOTOO60x80",
[Pho_SHAPE_RECTANGLE] = "PHOTOR60x80",
};
/***** Show user's photo *****/
HTM_TD_Begin ("class=\"OWNER_WORKS_PHOTO\"");
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();
@ -5453,12 +5453,12 @@ static void Brw_WriteFileSizeAndDate (struct FileMetadata *FileMetadata)
static void Brw_WriteFileOrFolderPublisher (unsigned Level,long UsrCod)
{
extern const char *Txt_Unknown_or_without_photo;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20B",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20B",
[Set_USR_PHOTO_OVAL ] = "PHOTOO15x20B",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20B",
[Pho_SHAPE_CIRCLE ] = "PHOTOC15x20B",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE15x20B",
[Pho_SHAPE_OVAL ] = "PHOTOO15x20B",
[Pho_SHAPE_RECTANGLE] = "PHOTOR15x20B",
};
bool ShowUsr = false;
struct UsrData UsrDat;
@ -5480,11 +5480,11 @@ static void Brw_WriteFileOrFolderPublisher (unsigned Level,long UsrCod)
if (ShowUsr)
/***** Show photo *****/
Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
else
Ico_PutIcon ("usr_bl.jpg",Txt_Unknown_or_without_photo,
ClassPhoto[Gbl.Prefs.UsrPhotos]);
ClassPhoto[Gbl.Prefs.PhotoShape]);
HTM_TD_End ();
@ -7845,12 +7845,12 @@ void Brw_ShowFileMetadata (void)
extern const char *Txt_user[Usr_NUM_SEXS];
extern const char *Txt_users[Usr_NUM_SEXS];
extern const char *Txt_Save_file_properties;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20",
[Set_USR_PHOTO_OVAL ] = "PHOTOO15x20",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20",
[Pho_SHAPE_CIRCLE ] = "PHOTOC15x20",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE15x20",
[Pho_SHAPE_OVAL ] = "PHOTOO15x20",
[Pho_SHAPE_RECTANGLE] = "PHOTOR15x20",
};
struct FileMetadata FileMetadata;
struct UsrData PublisherUsrDat;
@ -8016,7 +8016,7 @@ void Brw_ShowFileMetadata (void)
{
/* Show photo */
Pho_ShowUsrPhotoIfAllowed (&PublisherUsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
/* Write name */

View File

@ -602,13 +602,19 @@ 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.
*/
#define Log_PLATFORM_VERSION "SWAD 21.65.1 (2021-12-01)"
#define Log_PLATFORM_VERSION "SWAD 21.66 (2021-12-02)"
#define CSS_FILE "swad21.65.1.css"
#define JS_FILE "swad21.59.js"
/*
TODO: Rename CENTRE to CENTER in help wiki.
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
Version 21.66: Dec 02, 2021 New module swad_photo_shape for user photo shapes. (320876 lines)
Version 21.65.1: Dec 01, 2021 New shape of user photos. (320833 lines)
2 changes necessary in database:
ALTER TABLE set_ip_settings CHANGE COLUMN UsrPhotos PhotoShape TINYINT NOT NULL DEFAULT 0;
ALTER TABLE usr_data CHANGE COLUMN UsrPhotos PhotoShape TINYINT NOT NULL DEFAULT 0;
Version 21.65.1: Dec 01, 2021 New shape of user photos. (320833 lines)
2 changes necessary in database:
UPDATE set_ip_settings SET UsrPhotos=3 WHERE UsrPhotos=2;

View File

@ -556,12 +556,12 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
[Rol_NET] = ActSeeRecOneTch,
[Rol_TCH] = ActSeeRecOneTch,
};
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
const char *ClassTxt;
const char *ClassLink;
@ -595,7 +595,7 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role)
/***** Show photo *****/
HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
true);
HTM_TD_End ();
@ -658,12 +658,12 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
[Rol_NET] = ActSeeRecOneTch,
[Rol_TCH] = ActSeeRecOneTch,
};
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -712,7 +712,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
/***** Show photo *****/
HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -2701,7 +2701,7 @@ mysql> DESCRIBE set_ip_settings;
| IconSet | char(16) | NO | | NULL | |
| Menu | tinyint | NO | | 0 | |
| SideCols | tinyint | NO | | NULL | |
| UsrPhotos | tinyint | NO | | 0 | |
| PhotoShape | tinyint | NO | | 0 | |
+----------------+----------+------+-----+---------+-------+
10 rows in set (0,01 sec)
*/
@ -2715,7 +2715,7 @@ mysql> DESCRIBE set_ip_settings;
"IconSet CHAR(16) NOT NULL," // Ico_MAX_BYTES_ICON_SET_ID
"Menu TINYINT NOT NULL DEFAULT 0,"
"SideCols TINYINT NOT NULL,"
"UsrPhotos TINYINT NOT NULL DEFAULT 0,"
"PhotoShape TINYINT NOT NULL DEFAULT 0,"
"PRIMARY KEY (IP),"
"INDEX(UsrCod),"
"INDEX(LastChange))");
@ -3395,7 +3395,7 @@ mysql> DESCRIBE usr_data;
| Comments | text | NO | | NULL | |
| Menu | tinyint | NO | MUL | 0 | |
| SideCols | tinyint | NO | MUL | 3 | |
| UsrPhotos | tinyint | NO | MUL | 0 | |
| PhotoShape | tinyint | NO | MUL | 0 | |
| ThirdPartyCookies | enum('N','Y') | NO | MUL | N | |
| NotifNtfEvents | int | NO | | 0 | |
| EmailNtfEvents | int | NO | | 0 | |
@ -3435,7 +3435,7 @@ mysql> DESCRIBE usr_data;
"Comments TEXT NOT NULL," // Cns_MAX_BYTES_TEXT
"Menu TINYINT NOT NULL DEFAULT 0,"
"SideCols TINYINT NOT NULL DEFAULT 3,"
"UsrPhotos TINYINT NOT NULL DEFAULT 0,"
"PhotoShape TINYINT NOT NULL DEFAULT 0,"
"ThirdPartyCookies ENUM('N','Y') NOT NULL DEFAULT 'N',"
"NotifNtfEvents INT NOT NULL DEFAULT 0,"
"EmailNtfEvents INT NOT NULL DEFAULT 0,"
@ -3456,7 +3456,7 @@ mysql> DESCRIBE usr_data;
"INDEX(CtrCod),"
"INDEX(Menu),"
"INDEX(SideCols),"
"INDEX(UsrPhotos),"
"INDEX(PhotoShape),"
"INDEX(ThirdPartyCookies))");
/***** Table usr_duplicated *****/

View File

@ -2074,12 +2074,12 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
extern const char *Txt_Register;
extern const char *Txt_Reject;
extern const char *Txt_No_enrolment_requests;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -2243,7 +2243,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
/***** User photo *****/
HTM_TD_Begin ("class=\"DAT CT\" style=\"width:22px;\"");
Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -1483,12 +1483,12 @@ static void ExaRes_ComputeValidPrintScore (struct ExaPrn_Print *Print)
void ExaRes_ShowExamResultUser (struct UsrData *UsrDat)
{
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_OVAL ] = "PHOTOO45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
[Pho_SHAPE_CIRCLE ] = "PHOTOC45x60",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE45x60",
[Pho_SHAPE_OVAL ] = "PHOTOO45x60",
[Pho_SHAPE_RECTANGLE] = "PHOTOR45x60",
};
/***** Row begin *****/
@ -1509,7 +1509,7 @@ void ExaRes_ShowExamResultUser (struct UsrData *UsrDat)
HTM_TxtF (", %s",UsrDat->FrstName);
HTM_BR ();
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -211,7 +211,7 @@ static void Fig_GetAndShowNumUsrsPerIconSet (void);
static void Fig_GetAndShowNumUsrsPerMenu (void);
static void Fig_GetAndShowNumUsrsPerTheme (void);
static void Fig_GetAndShowNumUsrsPerSideColumns (void);
static void Fig_GetAndShowNumUsrsPerUserPhotos (void);
static void Fig_GetAndShowNumUsrsPerPhotoShape (void);
/*****************************************************************************/
/************************** Show use of the platform *************************/
@ -372,7 +372,7 @@ void Fig_ShowFigures (void)
[Fig_MENUS ] = Fig_GetAndShowNumUsrsPerMenu,
[Fig_THEMES ] = Fig_GetAndShowNumUsrsPerTheme,
[Fig_SIDE_COLUMNS ] = Fig_GetAndShowNumUsrsPerSideColumns,
[Fig_USER_PHOTOS ] = Fig_GetAndShowNumUsrsPerUserPhotos,
[Fig_PHOTO_SHAPES ] = Fig_GetAndShowNumUsrsPerPhotoShape,
[Fig_PRIVACY ] = Fig_GetAndShowNumUsrsPerPrivacy,
[Fig_COOKIES ] = Fig_GetAndShowNumUsrsPerCookies,
};
@ -3974,28 +3974,28 @@ static void Fig_GetAndShowNumUsrsPerSideColumns (void)
/****** Get and show number of users who have chosen a user photo shape ******/
/*****************************************************************************/
static void Fig_GetAndShowNumUsrsPerUserPhotos (void)
static void Fig_GetAndShowNumUsrsPerPhotoShape (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] =
extern const char *Txt_PHOTO_SHAPES[Pho_NUM_SHAPES];
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20B",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20B",
[Set_USR_PHOTO_OVAL ] = "PHOTOO15x20B",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20B",
[Pho_SHAPE_CIRCLE ] = "PHOTOC15x20B",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE15x20B",
[Pho_SHAPE_OVAL ] = "PHOTOO15x20B",
[Pho_SHAPE_RECTANGLE] = "PHOTOR15x20B",
};
Set_UsrPhotos_t UsrPhotos;
Pho_Shape_t Shape;
char *SubQuery;
unsigned NumUsrs[Set_NUM_USR_PHOTOS];
unsigned NumUsrs[Pho_NUM_SHAPES];
unsigned NumUsrsTotal = 0;
/***** Begin box and table *****/
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_USER_PHOTOS],
Box_BoxTableBegin (NULL,Txt_FIGURE_TYPES[Fig_PHOTO_SHAPES],
NULL,NULL,
Hlp_ANALYTICS_Figures_columns,Box_NOT_CLOSABLE,2);
@ -4007,39 +4007,39 @@ static void Fig_GetAndShowNumUsrsPerUserPhotos (void)
HTM_TR_End ();
/***** For each user photo shape... *****/
for (UsrPhotos = (Set_UsrPhotos_t) 0;
UsrPhotos <= (Set_UsrPhotos_t) (Set_NUM_USR_PHOTOS - 1);
UsrPhotos++)
for (Shape = (Pho_Shape_t) 0;
Shape <= (Pho_Shape_t) (Pho_NUM_SHAPES - 1);
Shape++)
{
/* Get the number of users who have chosen this layout of columns from database */
if (asprintf (&SubQuery,"usr_data.UsrPhotos=%u",
(unsigned) UsrPhotos) < 0)
if (asprintf (&SubQuery,"usr_data.PhotoShape=%u",
(unsigned) Shape) < 0)
Err_NotEnoughMemoryExit ();
NumUsrs[UsrPhotos] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
NumUsrs[Shape] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
free (SubQuery);
/* Update total number of users */
NumUsrsTotal += NumUsrs[UsrPhotos];
NumUsrsTotal += NumUsrs[Shape];
}
/***** 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++)
for (Shape = (Pho_Shape_t) 0;
Shape <= (Pho_Shape_t) (Pho_NUM_SHAPES - 1);
Shape++)
{
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_IMG (Cfg_URL_ICON_PUBLIC,"user.svg",Txt_PHOTO_SHAPES[Shape],
"class=\"%s\"",ClassPhoto[Shape]);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
HTM_Unsigned (NumUsrs[UsrPhotos]);
HTM_Unsigned (NumUsrs[Shape]);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[UsrPhotos] * 100.0 /
HTM_Percentage (NumUsrsTotal ? (double) NumUsrs[Shape] * 100.0 /
(double) NumUsrsTotal :
0.0);
HTM_TD_End ();

View File

@ -65,7 +65,7 @@ typedef enum
Fig_MENUS, // Number of users per menu
Fig_THEMES, // Number of users per theme
Fig_SIDE_COLUMNS, // Number of users per layout of columns
Fig_USER_PHOTOS, // Number of users per user photo shape
Fig_PHOTO_SHAPES, // Number of users per user photo shape
Fig_PRIVACY, // Number of users per privacity
Fig_COOKIES, // Number of users per acceptation of cookies
} Fig_FigureType_t;

View File

@ -612,12 +612,12 @@ static void Fol_ListFollowersUsr (struct UsrData *UsrDat)
static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
{
extern const char *Txt_Another_user_s_profile;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC60x80",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE60x80",
[Set_USR_PHOTO_OVAL ] = "PHOTOO60x80",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR60x80",
[Pho_SHAPE_CIRCLE ] = "PHOTOC60x80",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE60x80",
[Pho_SHAPE_OVAL ] = "PHOTOO60x80",
[Pho_SHAPE_RECTANGLE] = "PHOTOR60x80",
};
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
@ -625,7 +625,7 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
HTM_TD_Begin ("class=\"FOLLOW_PHOTO\"");
if (Visible)
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();
@ -671,12 +671,12 @@ static void Fol_ShowFollowedOrFollower (struct UsrData *UsrDat)
static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
{
extern const char *Txt_Another_user_s_profile;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
@ -686,7 +686,7 @@ static void Fol_WriteRowUsrToFollowOnRightColumn (struct UsrData *UsrDat)
HTM_TD_Begin ("class=\"CON_PHOTO COLOR%u\"",Gbl.RowEvenOdd);
if (Visible)
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

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

View File

@ -149,7 +149,7 @@ struct Globals
Mnu_Menu_t Menu;
The_Theme_t Theme;
unsigned SideCols;
Set_UsrPhotos_t UsrPhotos;
Pho_Shape_t PhotoShape;
char URLTheme[PATH_MAX + 1];
char URLIconSet[PATH_MAX + 1];
} Prefs;

View File

@ -25,6 +25,8 @@
/********************************** Headers **********************************/
/*****************************************************************************/
#include <string.h> // For strcasecmp
#include "swad_box.h"
#include "swad_database.h"
#include "swad_figure.h"
@ -214,3 +216,21 @@ Lan_Language_t Lan_GetParamLanguage (void)
Lan_NUM_LANGUAGES,
(unsigned long) Txt_Current_CGI_SWAD_Language);
}
/*****************************************************************************/
/************************** Get language from string *************************/
/*****************************************************************************/
Lan_Language_t Lan_GetLanguageFromStr (const char *Str)
{
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
Lan_Language_t Lan;
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
if (!strcasecmp (Str,Lan_STR_LANG_ID[Lan]))
return Lan;
return Lan_LANGUAGE_UNKNOWN;
}

View File

@ -61,5 +61,6 @@ void Lan_ChangeLanguage (void);
void Lan_UpdateMyLanguageToCurrentLanguage (void);
Lan_Language_t Lan_GetParamLanguage (void);
Lan_Language_t Lan_GetLanguageFromStr (const char *Str);
#endif

View File

@ -1041,12 +1041,12 @@ void MchRes_ShowOneMchResult (void)
extern const char *Txt_Score;
extern const char *Txt_Grade;
extern const char *Txt_Tags;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_OVAL ] = "PHOTOO45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
[Pho_SHAPE_CIRCLE ] = "PHOTOC45x60",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE45x60",
[Pho_SHAPE_OVAL ] = "PHOTOO45x60",
[Pho_SHAPE_RECTANGLE] = "PHOTOR45x60",
};
struct Gam_Games Games;
struct Gam_Game Game;
@ -1133,7 +1133,7 @@ void MchRes_ShowOneMchResult (void)
HTM_TxtF (", %s",UsrDat->FrstName);
HTM_BR ();
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -479,17 +479,17 @@ static void Msg_PutHiddenParamsSubjectAndContent (void)
static void Msg_ShowOneUniqueRecipient (void)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
/***** Show user's photo *****/
Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
/****** Write user's IDs ******/
@ -2291,12 +2291,12 @@ static void Msg_WriteSentOrReceivedMsgSubject (struct Msg_Messages *Messages,
void Msg_WriteMsgAuthor (struct UsrData *UsrDat,bool Enabled,const char *BgColor)
{
extern const char *Txt_Unknown_or_without_photo;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC30x40",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE30x40",
[Set_USR_PHOTO_OVAL ] = "PHOTOO30x40",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR30x40",
[Pho_SHAPE_CIRCLE ] = "PHOTOC30x40",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE30x40",
[Pho_SHAPE_OVAL ] = "PHOTOO30x40",
[Pho_SHAPE_RECTANGLE] = "PHOTOR30x40",
};
bool WriteAuthor;
@ -2319,11 +2319,11 @@ void Msg_WriteMsgAuthor (struct UsrData *UsrDat,bool Enabled,const char *BgColor
if (WriteAuthor)
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
else
Ico_PutIcon ("usr_bl.jpg",Txt_Unknown_or_without_photo,
ClassPhoto[Gbl.Prefs.UsrPhotos]);
ClassPhoto[Gbl.Prefs.PhotoShape]);
HTM_TD_End ();
@ -2459,12 +2459,12 @@ static void Msg_WriteMsgFrom (struct Msg_Messages *Messages,
extern const char *Txt_MSG_Sent;
extern const char *Txt_MSG_Sent_and_deleted;
extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
HTM_TABLE_Begin (NULL);
@ -2482,7 +2482,7 @@ static void Msg_WriteMsgFrom (struct Msg_Messages *Messages,
/***** Put user's photo *****/
HTM_TD_Begin ("class=\"CM\" style=\"width:30px;\"");
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();
@ -2535,12 +2535,12 @@ static void Msg_WriteMsgTo (struct Msg_Messages *Messages,long MsgCod)
[Msg_RECEIVED] = ActSeeRcvMsg,
[Msg_SENT ] = ActSeeSntMsg,
};
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -2623,7 +2623,7 @@ static void Msg_WriteMsgTo (struct Msg_Messages *Messages,long MsgCod)
false);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();
@ -2879,12 +2879,12 @@ void Msg_ListBannedUsrs (void)
extern const char *Txt_You_have_not_banned_any_sender;
extern const char *Txt_Banned_users;
extern const char *Txt_Sender_banned_click_to_unban_him;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res;
unsigned NumUsr;
@ -2928,7 +2928,7 @@ void Msg_ListBannedUsrs (void)
/* Show photo */
HTM_TD_Begin ("class=\"LM\" style=\"width:30px;\"");
Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -784,10 +784,6 @@ void Par_GetMainParams (void)
if (!Gbl.Session.IsOpen) // When no session open (no logged user)...
{
/***** Try to get settings changed from current IP *****/
if (Gbl.Prefs.Theme == The_THEME_UNKNOWN)
Gbl.Prefs.Theme = The_THEME_DEFAULT;
/***** Set path of theme and path of icon set *****/
snprintf (URL,sizeof (URL),"%s/%s",
Cfg_URL_ICON_THEMES_PUBLIC,The_ThemeId[Gbl.Prefs.Theme ]);

View File

@ -421,12 +421,12 @@ void Pho_ReqRemoveMyPhoto (void)
extern const char *Txt_Do_you_really_want_to_remove_your_photo;
extern const char *Txt_Remove_photo;
extern const char *Txt_The_photo_no_longer_exists;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOR186x248",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOR186x248",
[Set_USR_PHOTO_OVAL ] = "PHOTOR186x248",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR186x248",
[Pho_SHAPE_CIRCLE ] = "PHOTOR186x248",
[Pho_SHAPE_ELLIPSE ] = "PHOTOR186x248",
[Pho_SHAPE_OVAL ] = "PHOTOR186x248",
[Pho_SHAPE_RECTANGLE] = "PHOTOR186x248",
};
/***** Show current photo and help message *****/
@ -438,7 +438,7 @@ void Pho_ReqRemoveMyPhoto (void)
/* Show current photo */
Pho_ShowUsrPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_NO_ZOOM,
false);
/* End alert */
@ -498,12 +498,12 @@ void Pho_ReqRemoveUsrPhoto (void)
[Rol_INS_ADM] = ActRemOthPho,
[Rol_SYS_ADM] = ActRemOthPho,
};
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC186x248",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE186x248",
[Set_USR_PHOTO_OVAL ] = "PHOTOO186x248",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR186x248",
[Pho_SHAPE_CIRCLE ] = "PHOTOC186x248",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE186x248",
[Pho_SHAPE_OVAL ] = "PHOTOO186x248",
[Pho_SHAPE_RECTANGLE] = "PHOTOR186x248",
};
char PhotoURL[PATH_MAX + 1];
@ -527,7 +527,7 @@ void Pho_ReqRemoveUsrPhoto (void)
/* Show current photo */
Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,PhotoURL,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_NO_ZOOM,
false);
/* End alert */

142
swad_photo_shape.c Normal file
View File

@ -0,0 +1,142 @@
// swad_photo_shape.h: User photo shape
/*
SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2021 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include <stddef.h> // For NULL
#include "swad_action.h"
#include "swad_config.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_photo_shape.h"
#include "swad_setting_database.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/***************************** Private prototypes ****************************/
/*****************************************************************************/
static void Pho_PutIconsPhotoShape (__attribute__((unused)) void *Args);
/*****************************************************************************/
/******************* Put icons to select user photo shape ********************/
/*****************************************************************************/
void Pho_PutIconsToSelectPhotoShape (void)
{
extern const char *Hlp_PROFILE_Settings_user_photos;
extern const char *Txt_User_photos;
extern const char *Txt_PHOTO_SHAPES[Pho_NUM_SHAPES];
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Pho_SHAPE_CIRCLE ] = "ICO_HIGHLIGHT PHOTOC15x20B",
[Pho_SHAPE_ELLIPSE ] = "ICO_HIGHLIGHT PHOTOE15x20B",
[Pho_SHAPE_OVAL ] = "ICO_HIGHLIGHT PHOTOO15x20B",
[Pho_SHAPE_RECTANGLE] = "ICO_HIGHLIGHT PHOTOR15x20B",
};
Pho_Shape_t Shape;
Box_BoxBegin (NULL,Txt_User_photos,
Pho_PutIconsPhotoShape,NULL,
Hlp_PROFILE_Settings_user_photos,Box_NOT_CLOSABLE);
Set_BeginSettingsHead ();
Set_BeginOneSettingSelector ();
for (Shape = (Pho_Shape_t) 0;
Shape <= (Pho_Shape_t) (Pho_NUM_SHAPES - 1);
Shape++)
{
HTM_DIV_Begin ("class=\"%s\"",Shape == Gbl.Prefs.PhotoShape ? "PREF_ON" :
"PREF_OFF");
Frm_BeginForm (ActChgUsrPho);
Par_PutHiddenParamUnsigned (NULL,"PhotoShape",Shape);
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user.svg",Txt_PHOTO_SHAPES[Shape],ClassPhoto[Shape]);
Frm_EndForm ();
HTM_DIV_End ();
}
Set_EndOneSettingSelector ();
Set_EndSettingsHead ();
Box_BoxEnd ();
}
/*****************************************************************************/
/************** Put contextual icons in side-columns setting *****************/
/*****************************************************************************/
static void Pho_PutIconsPhotoShape (__attribute__((unused)) void *Args)
{
/***** Put icon to show a figure *****/
Fig_PutIconToShowFigure (Fig_PHOTO_SHAPES);
}
/*****************************************************************************/
/************************** Change user photo shape **************************/
/*****************************************************************************/
void Pho_ChangePhotoShape (void)
{
/***** Get param with user photo shape *****/
Gbl.Prefs.PhotoShape = Pho_GetParamPhotoShape ();
/***** Store side colums in database *****/
if (Gbl.Usrs.Me.Logged)
Set_DB_UpdateMySettingsAboutPhotoShape ();
/***** Set settings from current IP *****/
Set_SetSettingsFromIP ();
}
/*****************************************************************************/
/************** Get parameter used to change user photo shape ****************/
/*****************************************************************************/
Pho_Shape_t Pho_GetParamPhotoShape (void)
{
return (Pho_Shape_t) Par_GetParToUnsignedLong ("PhotoShape",
(Pho_Shape_t) 0,
(Pho_Shape_t) (Pho_NUM_SHAPES - 1),
Pho_SHAPE_DEFAULT);
}
/*****************************************************************************/
/*********************** Get photo shape from string *************************/
/*****************************************************************************/
Pho_Shape_t Pho_GetShapeFromStr (const char *Str)
{
unsigned UnsignedNum;
if (sscanf (Str,"%u",&UnsignedNum) == 1)
if (UnsignedNum < Pho_NUM_SHAPES)
return (Pho_Shape_t) UnsignedNum;
return Pho_SHAPE_DEFAULT;
}

51
swad_photo_shape.h Normal file
View File

@ -0,0 +1,51 @@
// swad_photo_shape.h: User photo shape
#ifndef _SWAD_PHO_SHA
#define _SWAD_PHO_SHA
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
Copyright (C) 1999-2021 Antonio Cañas Vargas
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/************************* Public types and constants ************************/
/*****************************************************************************/
// Related with user photo shape
#define Pho_NUM_SHAPES 4
typedef enum
{
Pho_SHAPE_CIRCLE = 0,
Pho_SHAPE_ELLIPSE = 1,
Pho_SHAPE_OVAL = 2,
Pho_SHAPE_RECTANGLE = 3,
} Pho_Shape_t;
#define Pho_SHAPE_DEFAULT Pho_SHAPE_CIRCLE
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Pho_PutIconsToSelectPhotoShape (void);
void Pho_ChangePhotoShape (void);
Pho_Shape_t Pho_GetParamPhotoShape (void);
Pho_Shape_t Pho_GetShapeFromStr (const char *Str);
#endif

View File

@ -1299,12 +1299,12 @@ void Prf_GetAndShowRankingClicksPerDay (void)
static void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank,bool ItsMe)
{
extern const char *Txt_Another_user_s_profile;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC30x40",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE30x40",
[Set_USR_PHOTO_OVAL ] = "PHOTOO30x48",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR30x40",
[Pho_SHAPE_CIRCLE ] = "PHOTOC30x40",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE30x40",
[Pho_SHAPE_OVAL ] = "PHOTOO30x48",
[Pho_SHAPE_RECTANGLE] = "PHOTOR30x40",
};
bool Visible = Pri_ShowingIsAllowed (UsrDat->BaPrfVisibility,UsrDat);
@ -1320,7 +1320,7 @@ static void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank,bool ItsM
if (Visible)
/***** User's photo *****/
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -2028,12 +2028,12 @@ static void Prj_ShowOneProjectMembersWithARole (struct Prj_Projects *Projects,
[Prj_ROLE_TUT] = ActReqAddTutPrj, // Tutor
[Prj_ROLE_EVL] = ActReqAddEvlPrj, // Evaluator
};
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@ -2136,7 +2136,7 @@ static void Prj_ShowOneProjectMembersWithARole (struct Prj_Projects *Projects,
/* Put user's photo */
HTM_TD_Begin ("class=\"PRJ_MEMBER_PHO\"");
Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -2599,18 +2599,18 @@ static void Rec_ShowInstitutionInHead (struct Ins_Instit *Ins,bool PutFormLinks)
static void Rec_ShowPhoto (struct UsrData *UsrDat)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOR186x248",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOR186x248",
[Set_USR_PHOTO_OVAL ] = "PHOTOR186x248",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR186x248",
[Pho_SHAPE_CIRCLE ] = "PHOTOR186x248",
[Pho_SHAPE_ELLIPSE ] = "PHOTOR186x248",
[Pho_SHAPE_OVAL ] = "PHOTOR186x248",
[Pho_SHAPE_RECTANGLE] = "PHOTOR186x248",
};
/***** User's photo *****/
HTM_TD_Begin ("rowspan=\"3\" class=\"REC_C3_TOP CT\"");
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();
}

View File

@ -42,9 +42,10 @@
#include "swad_HTML.h"
#include "swad_language.h"
#include "swad_layout.h"
#include "swad_notification.h"
#include "swad_menu.h"
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_photo.h"
#include "swad_privacy.h"
#include "swad_setting.h"
#include "swad_setting_database.h"
@ -62,9 +63,6 @@ extern struct Globals Gbl;
static void Set_PutIconsToSelectSideCols (void);
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_GetUsrListTypeFromForm (void);
static void Set_GetMyUsrListTypeFromDB (void);
@ -126,7 +124,7 @@ void Set_EditSettings (void)
HTM_DIV_End ();
HTM_DIV_Begin ("class=\"FRAME_INLINE\"");
Set_PutIconsToSelectUsrPhotos (); // 8. User photos
Pho_PutIconsToSelectPhotoShape (); // 8. User photos
HTM_DIV_End ();
Box_BoxEnd ();
@ -176,22 +174,10 @@ void Set_GetSettingsFromIP (void)
Gbl.Prefs.Menu = Mnu_GetMenuFromStr (row[4]);
/* Get if user wants to show side columns (row[5]) */
if (sscanf (row[5],"%u",&Gbl.Prefs.SideCols) == 1)
{
if (Gbl.Prefs.SideCols > Lay_SHOW_BOTH_COLUMNS)
Gbl.Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
}
else
Gbl.Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
Gbl.Prefs.SideCols = Set_GetSideColsFromStr (row[5]);
/* 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;
Gbl.Prefs.PhotoShape = Pho_GetShapeFromStr (row[6]);
}
/***** Free structure that stores the query result *****/
@ -205,12 +191,12 @@ void Set_GetSettingsFromIP (void)
void Set_SetSettingsFromIP (void)
{
/***** Update settings from current IP in database *****/
Set_DB_UpdateSettingsFromIP ();
/***** Update IP settings for current IP in database *****/
Set_DB_UpdateMyIPSettingsForCurrentIP ();
/***** If I am logged, update my settings in database for all my IP's *****/
/***** If I am logged, update my IP settings in database for all my IP's *****/
if (Gbl.Usrs.Me.Logged)
Set_DB_UpdateMySettingsFromIP ();
Set_DB_UpdateMyIPSettingsForAllMyIPs ();
}
/*****************************************************************************/
@ -289,82 +275,18 @@ unsigned Set_GetParamSideCols (void)
}
/*****************************************************************************/
/******************* Put icons to select user photo shape ********************/
/*************************** Get menu from string ****************************/
/*****************************************************************************/
static void Set_PutIconsToSelectUsrPhotos (void)
unsigned Set_GetSideColsFromStr (const char *Str)
{
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_OVAL ] = "ICO_HIGHLIGHT PHOTOO15x20B",
[Set_USR_PHOTO_RECTANGLE] = "ICO_HIGHLIGHT PHOTOR15x20B",
};
Set_UsrPhotos_t UsrPhotos;
unsigned UnsignedNum;
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 ();
}
if (sscanf (Str,"%u",&UnsignedNum) == 1)
if (UnsignedNum <= Lay_SHOW_BOTH_COLUMNS)
return UnsignedNum;
/*****************************************************************************/
/************** 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);
return Cfg_DEFAULT_COLUMNS;
}
/*****************************************************************************/

View File

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

View File

@ -149,13 +149,13 @@ void Set_DB_UpdateMySettingsAboutSideCols (void)
/**************** Update user photo shape on user data table *****************/
/*****************************************************************************/
void Set_DB_UpdateMySettingsAboutUsrPhotos (void)
void Set_DB_UpdateMySettingsAboutPhotoShape (void)
{
DB_QueryUPDATE ("can not update your setting about user photo shape",
"UPDATE usr_data"
" SET UsrPhotos=%u"
" SET PhotoShape=%u"
" WHERE UsrCod=%ld",
(unsigned) Gbl.Prefs.UsrPhotos,
(unsigned) Gbl.Prefs.PhotoShape,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
@ -423,7 +423,7 @@ void Set_DB_RemAllUsrsFromCrsSettings (long CrsCod)
/**************** Update settings from current IP in database ****************/
/*****************************************************************************/
void Set_DB_UpdateSettingsFromIP (void)
void Set_DB_UpdateMyIPSettingsForCurrentIP (void)
{
extern const char *The_ThemeId[The_NUM_THEMES];
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
@ -431,7 +431,7 @@ void Set_DB_UpdateSettingsFromIP (void)
DB_QueryREPLACE ("can not store settings from current IP address",
"REPLACE INTO set_ip_settings"
" (IP,UsrCod,LastChange,"
"FirstDayOfWeek,DateFormat,Theme,IconSet,Menu,SideCols,UsrPhotos)"
"FirstDayOfWeek,DateFormat,Theme,IconSet,Menu,SideCols,PhotoShape)"
" VALUES"
" ('%s',%ld,NOW(),"
"%u,%u,'%s','%s',%u,%u,%u)",
@ -443,14 +443,14 @@ void Set_DB_UpdateSettingsFromIP (void)
Ico_IconSetId[Gbl.Prefs.IconSet],
(unsigned) Gbl.Prefs.Menu,
Gbl.Prefs.SideCols,
(unsigned) Gbl.Prefs.UsrPhotos);
(unsigned) Gbl.Prefs.PhotoShape);
}
/*****************************************************************************/
/*************** Update my settings from current IP in database **************/
/**************** Update my settings from all IP in database *****************/
/*****************************************************************************/
void Set_DB_UpdateMySettingsFromIP (void)
void Set_DB_UpdateMyIPSettingsForAllMyIPs (void)
{
extern const char *The_ThemeId[The_NUM_THEMES];
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
@ -463,7 +463,7 @@ void Set_DB_UpdateMySettingsFromIP (void)
"IconSet='%s',"
"Menu=%u,"
"SideCols=%u,"
"UsrPhotos=%u"
"PhotoShape=%u"
" WHERE UsrCod=%ld",
Gbl.Prefs.FirstDayOfWeek,
(unsigned) Gbl.Prefs.DateFormat,
@ -471,7 +471,7 @@ void Set_DB_UpdateMySettingsFromIP (void)
Ico_IconSetId[Gbl.Prefs.IconSet],
(unsigned) Gbl.Prefs.Menu,
Gbl.Prefs.SideCols,
(unsigned) Gbl.Prefs.UsrPhotos,
(unsigned) Gbl.Prefs.PhotoShape,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
@ -489,7 +489,7 @@ unsigned Set_DB_GetSettingsFromIP (MYSQL_RES **mysql_res)
"IconSet," // row[3]
"Menu," // row[4]
"SideCols," // row[5]
"UsrPhotos" // row[6]
"PhotoShape" // row[6]
" FROM set_ip_settings"
" WHERE IP='%s'",
Gbl.IP);

View File

@ -35,7 +35,7 @@ void Set_DB_UpdateMySettingsAboutIconSet (const char *IconSetId);
void Set_DB_UpdateMySettingsAboutMenu (Mnu_Menu_t Menu);
void Set_DB_UpdateMySettingsAboutTheme (const char *ThemeId);
void Set_DB_UpdateMySettingsAboutSideCols (void);
void Set_DB_UpdateMySettingsAboutUsrPhotos (void);
void Set_DB_UpdateMySettingsAboutPhotoShape (void);
void Set_DB_UpdateMySettingsAboutPhotoVisibility (void);
void Set_DB_UpdateMySettingsAboutBasicProfile (void);
void Set_DB_UpdateMySettingsAboutExtendedProfile (void);
@ -60,8 +60,8 @@ void Set_DB_RemUsrFromAllCrssSettings (long UsrCod);
void Set_DB_RemAllUsrsFromCrsSettings (long CrsCod);
//------------------- IP settings (when no user logged) -----------------------
void Set_DB_UpdateSettingsFromIP (void);
void Set_DB_UpdateMySettingsFromIP (void);
void Set_DB_UpdateMyIPSettingsForCurrentIP (void);
void Set_DB_UpdateMyIPSettingsForAllMyIPs (void);
unsigned Set_DB_GetSettingsFromIP (MYSQL_RES **mysql_res);

View File

@ -1306,12 +1306,12 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType,
extern const char *Txt_Role;
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];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20",
[Set_USR_PHOTO_OVAL ] = "PHOTOO15x20",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20",
[Pho_SHAPE_CIRCLE ] = "PHOTOC15x20",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE15x20",
[Pho_SHAPE_OVAL ] = "PHOTOO15x20",
[Pho_SHAPE_RECTANGLE] = "PHOTOR15x20",
};
MYSQL_ROW row;
unsigned NumHit;
@ -1355,7 +1355,7 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType,
/* Show the photo */
HTM_TD_Begin ("class=\"CT COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -2156,12 +2156,12 @@ void TstPrn_ShowOnePrint (void)
extern const char *Txt_Score;
extern const char *Txt_Grade;
extern const char *Txt_Tags;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_OVAL ] = "PHOTOO45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
[Pho_SHAPE_CIRCLE ] = "PHOTOC45x60",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE45x60",
[Pho_SHAPE_OVAL ] = "PHOTOO45x60",
[Pho_SHAPE_RECTANGLE] = "PHOTOR45x60",
};
struct TstPrn_Print Print;
Dat_StartEndTime_t StartEndTime;
@ -2224,7 +2224,7 @@ void TstPrn_ShowOnePrint (void)
HTM_TxtF (", %s",Gbl.Usrs.Other.UsrDat.FrstName);
HTM_BR ();
Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Other.UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -30585,6 +30585,89 @@ const char *Txt_PHOTO_PROCESSING_CAPTIONS[3] =
#endif
};
const char *Txt_PHOTO_SHAPES[Pho_NUM_SHAPES] =
{
#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
"Oval"
#elif L==2 // de
"Oval"
#elif L==3 // en
"Oval"
#elif L==4 // es
"&Oacute;valo"
#elif L==5 // fr
"Ovale"
#elif L==6 // gn
"&Oacute;valo" // Okoteve traducción
#elif L==7 // it
"Ovale"
#elif L==8 // pl
"Owalny"
#elif L==9 // pt
"Ovalo"
#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_Photo_removed =
#if L==1 // ca
"Fotograf&iacute;a eliminada."; // Necessita traduccio
@ -44592,7 +44675,7 @@ const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES] =
"Colunas"
#endif
,
[Fig_USER_PHOTOS] =
[Fig_PHOTO_SHAPES] =
#if L==1 // ca
"Fotos d'usuaris"
#elif L==2 // de
@ -55599,89 +55682,6 @@ const char *Txt_User_photos =
"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
"Oval"
#elif L==2 // de
"Oval"
#elif L==3 // en
"Oval"
#elif L==4 // es
"&Oacute;valo"
#elif L==5 // fr
"Ovale"
#elif L==6 // gn
"&Oacute;valo" // Okoteve traducción
#elif L==7 // it
"Ovale"
#elif L==8 // pl
"Owalny"
#elif L==9 // pt
"Ovalo"
#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 =
#if L==1 // ca
"Usuaris";

View File

@ -393,7 +393,7 @@ The_Theme_t The_GetParamTheme (void)
if (!strcmp (ThemeId,The_ThemeId[Theme]))
return Theme;
return The_THEME_UNKNOWN;
return The_THEME_DEFAULT;
}
/*****************************************************************************/
@ -410,5 +410,5 @@ The_Theme_t The_GetThemeFromStr (const char *Str)
if (!strcasecmp (Str,The_ThemeId[Theme]))
return Theme;
return The_THEME_UNKNOWN;
return The_THEME_DEFAULT;
}

View File

@ -41,7 +41,6 @@ typedef enum
The_THEME_BLUE = 3,
The_THEME_YELLOW = 4,
The_THEME_PINK = 5,
The_THEME_UNKNOWN = 6,
} The_Theme_t;
#define The_THEME_DEFAULT The_THEME_PINK

View File

@ -184,12 +184,12 @@ void Tml_Com_PutPhotoAndFormToWriteNewComm (const struct Tml_Timeline *Timeline,
static void Tml_Com_ShowAuthorPhoto (struct UsrData *UsrDat)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC30x40",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE30x40",
[Set_USR_PHOTO_OVAL ] = "PHOTOO30x40",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR30x40",
[Pho_SHAPE_CIRCLE ] = "PHOTOC30x40",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE30x40",
[Pho_SHAPE_OVAL ] = "PHOTOO30x40",
[Pho_SHAPE_RECTANGLE] = "PHOTOR30x40",
};
/***** Show author's photo *****/
@ -198,7 +198,7 @@ static void Tml_Com_ShowAuthorPhoto (struct UsrData *UsrDat)
/* Author's photo */
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
true); // Use unique id
/* End container */

View File

@ -289,12 +289,12 @@ static void Tml_Not_WriteNote (const struct Tml_Timeline *Timeline,
void Tml_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_OVAL ] = "PHOTOO45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
[Pho_SHAPE_CIRCLE ] = "PHOTOC45x60",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE45x60",
[Pho_SHAPE_OVAL ] = "PHOTOO45x60",
[Pho_SHAPE_RECTANGLE] = "PHOTOR45x60",
};
/***** Begin container *****/
@ -302,7 +302,7 @@ void Tml_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique)
/***** Photo *****/
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
FormUnique);
/***** End container *****/

View File

@ -179,12 +179,12 @@ static void Tml_Usr_ShowNumSharersOrFavers (unsigned NumUsrs)
static void Tml_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res,
unsigned NumUsrs,unsigned NumFirstUsrs)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC12x16",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE12x16",
[Set_USR_PHOTO_OVAL ] = "PHOTOO12x16",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR12x16",
[Pho_SHAPE_CIRCLE ] = "PHOTOC12x16",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE12x16",
[Pho_SHAPE_OVAL ] = "PHOTOO12x16",
[Pho_SHAPE_RECTANGLE] = "PHOTOR12x16",
};
unsigned NumUsr;
struct UsrData UsrDat;
@ -218,7 +218,7 @@ static void Tml_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res,
/* User's photo */
Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
true); // Use unique id
/* End container */

View File

@ -333,14 +333,14 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
UsrDat->Tch.Office[0] = '\0';
UsrDat->Tch.OfficePhone[0] = '\0';
UsrDat->Prefs.Language = Lan_LANGUAGE_UNKNOWN; // Language unknown
UsrDat->Prefs.FirstDayOfWeek = Cal_FIRST_DAY_OF_WEEK_DEFAULT; // Default first day of week
UsrDat->Prefs.DateFormat = Dat_FORMAT_DEFAULT ; // Default date format
UsrDat->Prefs.Theme = The_THEME_DEFAULT;
UsrDat->Prefs.IconSet = Ico_ICON_SET_DEFAULT;
UsrDat->Prefs.Menu = Mnu_MENU_DEFAULT;
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
UsrDat->Prefs.UsrPhotos = Set_USR_PHOTOS_DEFAULT;
UsrDat->Prefs.Language = Lan_LANGUAGE_UNKNOWN; // Language unknown
UsrDat->Prefs.FirstDayOfWeek = Cal_FIRST_DAY_OF_WEEK_DEFAULT; // Default first day of week
UsrDat->Prefs.DateFormat = Dat_FORMAT_DEFAULT ; // Default date format
UsrDat->Prefs.Theme = The_THEME_DEFAULT;
UsrDat->Prefs.IconSet = Ico_ICON_SET_DEFAULT;
UsrDat->Prefs.Menu = Mnu_MENU_DEFAULT;
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
UsrDat->Prefs.PhotoShape = Pho_SHAPE_DEFAULT;
UsrDat->Prefs.AcceptThirdPartyCookies = false; // By default, don't accept third party cookies
UsrDat->NtfEvents.SendEmail = 0; // By default, don't notify anything
}
@ -448,13 +448,8 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,
Usr_GetPrefs_t GetPrefs,
Usr_GetRoleInCurrentCrs_t GetRoleInCurrentCrs)
{
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
extern const char *The_ThemeId[The_NUM_THEMES];
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
The_Theme_t Theme;
Ico_IconSet_t IconSet;
Lan_Language_t Lan;
/***** Get user's data from database *****/
@ -543,15 +538,7 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,
if (GetPrefs == Usr_GET_PREFS)
{
/* Get language (row[23]) */
UsrDat->Prefs.Language = Lan_LANGUAGE_UNKNOWN; // Language unknown
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
if (!strcasecmp (row[23],Lan_STR_LANG_ID[Lan]))
{
UsrDat->Prefs.Language = Lan;
break;
}
UsrDat->Prefs.Language = Lan_GetLanguageFromStr (row[23]);
/* Get first day of week (row[24]) */
UsrDat->Prefs.FirstDayOfWeek = Cal_GetFirstDayOfWeekFromStr (row[24]);
@ -560,47 +547,19 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,
UsrDat->Prefs.DateFormat = Dat_GetDateFormatFromStr (row[25]);
/* Get theme (row[26]) */
UsrDat->Prefs.Theme = The_THEME_DEFAULT;
for (Theme = (The_Theme_t) 0;
Theme <= (The_Theme_t) (The_NUM_THEMES - 1);
Theme++)
if (!strcasecmp (row[26],The_ThemeId[Theme]))
{
UsrDat->Prefs.Theme = Theme;
break;
}
UsrDat->Prefs.Theme = The_GetThemeFromStr (row[26]);
/* Get icon set (row[27]) */
UsrDat->Prefs.IconSet = Ico_ICON_SET_DEFAULT;
for (IconSet = (Ico_IconSet_t) 0;
IconSet <= (Ico_IconSet_t) (Ico_NUM_ICON_SETS - 1);
IconSet++)
if (!strcasecmp (row[27],Ico_IconSetId[IconSet]))
{
UsrDat->Prefs.IconSet = IconSet;
break;
}
UsrDat->Prefs.IconSet = Ico_GetIconSetFromStr (row[27]);
/* Get menu (row[28]) */
UsrDat->Prefs.Menu = Mnu_GetMenuFromStr (row[28]);
/* Get if user wants to show side columns (row[29]) */
if (sscanf (row[29],"%u",&UsrDat->Prefs.SideCols) == 1)
{
if (UsrDat->Prefs.SideCols > Lay_SHOW_BOTH_COLUMNS)
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
}
else
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
UsrDat->Prefs.SideCols = Set_GetSideColsFromStr (row[29]);
/* Get user settings on user photo shape (row[30]) */
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;
UsrDat->Prefs.PhotoShape = Pho_GetShapeFromStr (row[30]);
/* Get if user accepts third party cookies (row[31]) */
UsrDat->Prefs.AcceptThirdPartyCookies = (row[31][0] == 'Y');
@ -1390,12 +1349,12 @@ void Usr_WriteLoggedUsrHead (void)
extern const char *The_ClassUsr[The_NUM_THEMES];
extern const char *Txt_Role;
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC18x24",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE18x24",
[Set_USR_PHOTO_OVAL ] = "PHOTOO18x24",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR18x24",
[Pho_SHAPE_CIRCLE ] = "PHOTOC18x24",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE18x24",
[Pho_SHAPE_OVAL ] = "PHOTOO18x24",
[Pho_SHAPE_RECTANGLE] = "PHOTOR18x24",
};
unsigned NumAvailableRoles = Rol_GetNumAvailableRoles ();
@ -1422,7 +1381,7 @@ void Usr_WriteLoggedUsrHead (void)
/***** Show my photo *****/
Pho_ShowUsrPhotoIfAllowed (&Gbl.Usrs.Me.UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
/***** User's name *****/
@ -1985,7 +1944,6 @@ static void Usr_SetMyPrefsAndRoles (void)
{
extern const char *The_ThemeId[The_NUM_THEMES];
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
char URL[PATH_MAX + 1];
bool GetRoleAndActionFromLastData;
Act_Action_t LastSuperAction;
bool JustAfterLogin = Gbl.Action.Act == ActLogIn ||
@ -2002,18 +1960,15 @@ static void Usr_SetMyPrefsAndRoles (void)
/***** Set settings from my settings *****/
Gbl.Prefs.FirstDayOfWeek = Gbl.Usrs.Me.UsrDat.Prefs.FirstDayOfWeek;
Gbl.Prefs.DateFormat = Gbl.Usrs.Me.UsrDat.Prefs.DateFormat;
Gbl.Prefs.IconSet = Gbl.Usrs.Me.UsrDat.Prefs.IconSet;
Gbl.Prefs.Menu = Gbl.Usrs.Me.UsrDat.Prefs.Menu;
Gbl.Prefs.Theme = Gbl.Usrs.Me.UsrDat.Prefs.Theme;
Gbl.Prefs.SideCols = Gbl.Usrs.Me.UsrDat.Prefs.SideCols;
Gbl.Prefs.Theme = Gbl.Usrs.Me.UsrDat.Prefs.Theme;
snprintf (URL,sizeof (URL),"%s/%s",
Cfg_URL_ICON_THEMES_PUBLIC,The_ThemeId[Gbl.Prefs.Theme]);
Str_Copy (Gbl.Prefs.URLTheme ,URL,sizeof (Gbl.Prefs.URLTheme ) - 1);
Gbl.Prefs.IconSet = Gbl.Usrs.Me.UsrDat.Prefs.IconSet;
snprintf (URL,sizeof (URL),"%s/%s",
Gbl.Prefs.PhotoShape = Gbl.Usrs.Me.UsrDat.Prefs.PhotoShape;
snprintf (Gbl.Prefs.URLIconSet,sizeof (Gbl.Prefs.URLIconSet),"%s/%s",
Cfg_URL_ICON_SETS_PUBLIC,Ico_IconSetId[Gbl.Prefs.IconSet]);
Str_Copy (Gbl.Prefs.URLIconSet,URL,sizeof (Gbl.Prefs.URLIconSet) - 1);
snprintf (Gbl.Prefs.URLTheme,sizeof (Gbl.Prefs.URLTheme),"%s/%s",
Cfg_URL_ICON_THEMES_PUBLIC,The_ThemeId[Gbl.Prefs.Theme]);
/***** Construct the path to my directory *****/
Usr_ConstructPathUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Me.PathDir);
@ -2193,12 +2148,12 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
{
extern const char *Txt_Enrolment_confirmed;
extern const char *Txt_Enrolment_not_confirmed;
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
char BgColor[Usr_MAX_BYTES_BG_COLOR + 1];
bool UsrIsTheMsgSender = PutCheckBoxToSelectUsr &&
@ -2254,7 +2209,7 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
/***** Show user's photo *****/
HTM_TD_Begin ("class=\"CM %s\"",BgColor);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();
}
@ -2286,12 +2241,12 @@ void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
struct Ins_Instit Ins;
struct Ctr_Center Ctr;
@ -2305,7 +2260,7 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
/***** Show guest's photo *****/
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_NO_ZOOM,
false);
HTM_TD_End ();
}
@ -2375,12 +2330,12 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat)
static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
unsigned NumGrpTyp,NumField;
MYSQL_RES *mysql_res;
@ -2398,7 +2353,7 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
/***** Show student's photo *****/
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_NO_ZOOM,
false);
HTM_TD_End ();
}
@ -2486,12 +2441,12 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
struct Ins_Instit Ins;
struct Ctr_Center Ctr;
@ -2507,7 +2462,7 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
/***** Show teacher's photo *****/
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_NO_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_NO_ZOOM,
false);
HTM_TD_End ();
}
@ -2567,12 +2522,12 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
static void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC21x28",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE21x28",
[Set_USR_PHOTO_OVAL ] = "PHOTOO21x28",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR21x28",
[Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
};
struct Ins_Instit Ins;
@ -2589,7 +2544,7 @@ static void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
/***** Show administrator's photo *****/
HTM_TD_Begin ("class=\"LM COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();
}
@ -6141,20 +6096,20 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
struct SelectedUsrs *SelectedUsrs,
bool PutCheckBoxToSelectUsr)
{
static const char *ClassPhoto[Usr_NUM_CLASS_PHOTO_TYPE][Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Usr_NUM_CLASS_PHOTO_TYPE][Pho_NUM_SHAPES] =
{
[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_OVAL ] = "PHOTOO21x28",
[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_OVAL ] = "PHOTOO45x60",
[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_OVAL ] = "PHOTOO45x60",
[Usr_CLASS_PHOTO_PRN ][Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
[Usr_CLASS_PHOTO_SEL ][Pho_SHAPE_CIRCLE ] = "PHOTOC21x28",
[Usr_CLASS_PHOTO_SEL ][Pho_SHAPE_ELLIPSE ] = "PHOTOE21x28",
[Usr_CLASS_PHOTO_SEL ][Pho_SHAPE_OVAL ] = "PHOTOO21x28",
[Usr_CLASS_PHOTO_SEL ][Pho_SHAPE_RECTANGLE] = "PHOTOR21x28",
[Usr_CLASS_PHOTO_SEL_SEE][Pho_SHAPE_CIRCLE ] = "PHOTOC45x60",
[Usr_CLASS_PHOTO_SEL_SEE][Pho_SHAPE_ELLIPSE ] = "PHOTOE45x60",
[Usr_CLASS_PHOTO_SEL_SEE][Pho_SHAPE_OVAL ] = "PHOTOO45x60",
[Usr_CLASS_PHOTO_SEL_SEE][Pho_SHAPE_RECTANGLE] = "PHOTOR45x60",
[Usr_CLASS_PHOTO_PRN ][Pho_SHAPE_CIRCLE ] = "PHOTOC45x60",
[Usr_CLASS_PHOTO_PRN ][Pho_SHAPE_ELLIPSE ] = "PHOTOE45x60",
[Usr_CLASS_PHOTO_PRN ][Pho_SHAPE_OVAL ] = "PHOTOO45x60",
[Usr_CLASS_PHOTO_PRN ][Pho_SHAPE_RECTANGLE] = "PHOTOR45x60",
};
unsigned NumUsr;
bool TRIsOpen = false;
@ -6205,7 +6160,9 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
SelectedUsrs);
/***** Show photo *****/
Pho_ShowUsrPhotoIfAllowed (&UsrDat,ClassPhoto[ClassPhotoType][Gbl.Prefs.UsrPhotos],Pho_ZOOM,false);
Pho_ShowUsrPhotoIfAllowed (&UsrDat,
ClassPhoto[ClassPhotoType][Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
/***** Photo foot *****/
HTM_DIV_Begin ("class=\"CLASSPHOTO_CAPTION\"");
@ -6374,12 +6331,12 @@ unsigned Usr_GetTotalNumberOfUsers (void)
void Usr_WriteAuthor1Line (long UsrCod,bool Hidden)
{
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC15x20",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE15x20",
[Set_USR_PHOTO_OVAL ] = "PHOTOO15x20",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR15x20",
[Pho_SHAPE_CIRCLE ] = "PHOTOC15x20",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE15x20",
[Pho_SHAPE_OVAL ] = "PHOTOO15x20",
[Pho_SHAPE_RECTANGLE] = "PHOTOR15x20",
};
bool ShowPhoto = false;
char PhotoURL[PATH_MAX + 1];
@ -6398,7 +6355,7 @@ void Usr_WriteAuthor1Line (long UsrCod,bool Hidden)
/***** Show photo *****/
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,false);
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,false);
/***** Write name *****/
HTM_DIV_Begin ("class=\"AUTHOR_1_LINE %s\"",Hidden ? "AUTHOR_TXT_LIGHT" :
@ -6422,12 +6379,12 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows)
[Rol_NET] = ActSeeRecOneTch,
[Rol_TCH] = ActSeeRecOneTch,
};
static const char *ClassPhoto[Set_NUM_USR_PHOTOS] =
static const char *ClassPhoto[Pho_NUM_SHAPES] =
{
[Set_USR_PHOTO_CIRCLE ] = "PHOTOC45x60",
[Set_USR_PHOTO_ELLIPSE ] = "PHOTOE45x60",
[Set_USR_PHOTO_OVAL ] = "PHOTOO45x60",
[Set_USR_PHOTO_RECTANGLE] = "PHOTOR45x60",
[Pho_SHAPE_CIRCLE ] = "PHOTOC45x60",
[Pho_SHAPE_ELLIPSE ] = "PHOTOE45x60",
[Pho_SHAPE_OVAL ] = "PHOTOO45x60",
[Pho_SHAPE_RECTANGLE] = "PHOTOR45x60",
};
/***** Show user's photo *****/
@ -6437,7 +6394,7 @@ void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows)
else
HTM_TD_Begin ("class=\"LT LINE_BOTTOM COLOR%u\"",Gbl.RowEvenOdd);
Pho_ShowUsrPhotoIfAllowed (UsrDat,
ClassPhoto[Gbl.Prefs.UsrPhotos],Pho_ZOOM,
ClassPhoto[Gbl.Prefs.PhotoShape],Pho_ZOOM,
false);
HTM_TD_End ();

View File

@ -40,6 +40,7 @@
#include "swad_menu.h"
#include "swad_nickname.h"
#include "swad_password.h"
#include "swad_photo_shape.h"
#include "swad_privacy_visibility_type.h"
#include "swad_role_type.h"
#include "swad_scope.h"
@ -214,7 +215,7 @@ struct UsrData
Ico_IconSet_t IconSet;
Mnu_Menu_t Menu;
unsigned SideCols;
Set_UsrPhotos_t UsrPhotos;
Pho_Shape_t PhotoShape;
bool AcceptThirdPartyCookies; // User has accepted third party cookies
} Prefs;
};

View File

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