mirror of https://github.com/acanas/swad-core.git
Version 14.78
This commit is contained in:
parent
25d7b52dce
commit
b440628ac2
|
@ -10502,3 +10502,16 @@ CREATE TABLE IF NOT EXISTS admin (UsrCod INT NOT NULL,Scope ENUM('Sys','Ins','Ct
|
|||
INSERT INTO admin (UsrCod,Scope,Cod) SELECT UsrCod,'Deg',DegCod FROM deg_admin WHERE DegCod>'0';
|
||||
INSERT INTO admin (UsrCod,Scope,Cod) SELECT UsrCod,'Sys',DegCod FROM deg_admin WHERE DegCod='-2';
|
||||
DROP TABLE deg_admin;
|
||||
|
||||
----- 2015-03-06, swad14.78
|
||||
|
||||
ALTER TABLE usr_data ADD COLUMN PhotoVisibility ENUM('user','course','system','world') NOT NULL DEFAULT 'user' AFTER PublicPhoto;
|
||||
UPDATE usr_data SET PhotoVisibility='user' WHERE PublicPhoto='N';
|
||||
UPDATE usr_data SET PhotoVisibility='system' WHERE PublicPhoto='Y';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1125,7 +1125,7 @@ CREATE TABLE IF NOT EXISTS usr_data (
|
|||
IconSet CHAR(16) NOT NULL,
|
||||
Language CHAR(2) NOT NULL,
|
||||
Photo CHAR(43) NOT NULL,
|
||||
PublicPhoto ENUM('N','Y') NOT NULL DEFAULT 'N',
|
||||
PhotoVisibility ENUM('user','course','system','world') NOT NULL DEFAULT 'user',
|
||||
CtyCod INT NOT NULL DEFAULT -1,
|
||||
InsCtyCod INT NOT NULL DEFAULT -1,
|
||||
InsCod INT NOT NULL DEFAULT -1,
|
||||
|
|
|
@ -410,8 +410,9 @@ static bool Acc_GetParamsNewAccount (char *NewNicknameWithoutArroba,
|
|||
|
||||
void Acc_CreateNewUsr (struct UsrData *UsrDat)
|
||||
{
|
||||
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
|
||||
extern const char *The_ThemeId[The_NUM_THEMES];
|
||||
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
|
||||
extern const char *Pho_VisibilityDB[Pho_NUM_VISIBILITIES];
|
||||
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
||||
extern const char *Usr_StringsSexDB[Usr_NUM_SEXS];
|
||||
char Query[2048];
|
||||
|
@ -431,12 +432,12 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat)
|
|||
/***** Insert new user in database *****/
|
||||
/* Insert user's data */
|
||||
sprintf (Query,"INSERT INTO usr_data (EncryptedUsrCod,Password,Surname1,Surname2,FirstName,Sex,"
|
||||
"Layout,Theme,IconSet,Language,PublicPhoto,"
|
||||
"Layout,Theme,IconSet,Language,PhotoVisibility,"
|
||||
"CtyCod,"
|
||||
"LocalAddress,LocalPhone,FamilyAddress,FamilyPhone,OriginPlace,Birthday,Comments,"
|
||||
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
|
||||
" VALUES ('%s','%s','%s','%s','%s','%s',"
|
||||
"'%u','%s','%s','%s','%c',"
|
||||
"'%u','%s','%s','%s','%s',"
|
||||
"'%ld',"
|
||||
"'%s','%s','%s','%s','%s','%04u-%02u-%02u','%s',"
|
||||
"'%u','%u','-1','0')",
|
||||
|
@ -448,8 +449,7 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat)
|
|||
The_ThemeId[UsrDat->Prefs.Theme],
|
||||
Ico_IconSetId[UsrDat->Prefs.IconSet],
|
||||
Txt_STR_LANG_ID[UsrDat->Prefs.Language],
|
||||
UsrDat->PublicPhoto ? 'Y' :
|
||||
'N',
|
||||
Pho_VisibilityDB[UsrDat->PhotoVisibility],
|
||||
UsrDat->CtyCod,
|
||||
UsrDat->LocalAddress ,UsrDat->LocalPhone,
|
||||
UsrDat->FamilyAddress,UsrDat->FamilyPhone,
|
||||
|
|
|
@ -2591,7 +2591,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActDetMyPho */{ 693,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_DATA,Act_MAIN_WINDOW,NULL ,Pho_RecMyPhotoDetFaces ,NULL},
|
||||
/* ActUpdMyPho */{ 694,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Pho_UpdateMyPhoto1 ,Pho_UpdateMyPhoto2 ,NULL},
|
||||
/* ActRemMyPho */{ 428,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Pho_RemoveMyPhoto1 ,Pho_RemoveMyPhoto2 ,NULL},
|
||||
/* ActChgPubPho */{ 774,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Pho_ChangePublicPhoto ,Rec_ShowMyCommonRecordUpd ,NULL},
|
||||
/* ActChgPubPho */{ 774,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,Pho_ChangePhotoVisibility ,Rec_ShowMyCommonRecordUpd ,NULL},
|
||||
|
||||
/* ActReqEdiMyIns */{1165,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ShowFormMyInsCtrDpt ,NULL},
|
||||
/* ActChgCtyMyIns */{1166,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Rec_ChgCountryOfMyInstitution ,NULL},
|
||||
|
|
|
@ -103,11 +103,18 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.77.3 (2015/03/05)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 14.78 (2015/03/06)"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h | tail -1
|
||||
/*
|
||||
Version 14.78: Mar 06, 2015 Field PublicPhoto is replaced by field PhotoVisibility. (178577 lines)
|
||||
4 changes necessary in database:
|
||||
ALTER TABLE usr_data ADD COLUMN PhotoVisibility ENUM('user','course','system','world') NOT NULL DEFAULT 'user' AFTER PublicPhoto;
|
||||
UPDATE usr_data SET PhotoVisibility='user' WHERE PublicPhoto='N';
|
||||
UPDATE usr_data SET PhotoVisibility='system' WHERE PublicPhoto='Y';
|
||||
ALTER TABLE usr_data DROP COLUMN PublicPhoto;
|
||||
|
||||
Version 14.77.3: Mar 05, 2015 Changes in shared record. (178509 lines)
|
||||
Version 14.77.2: Mar 05, 2015 Changes in shared record. (178504 lines)
|
||||
Version 14.77.1: Mar 05, 2015 New option to select the user and then go to his/her public user's profile. (178475 lines)
|
||||
|
@ -115,7 +122,7 @@
|
|||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1401','es','N','Solicitar perfil de usuario');
|
||||
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1402','es','N','Ver perfil de usuario');
|
||||
|
||||
Version 14.77 : Mar 04, 2015 New parameter "UsrNick" to go to a public user's profile. (178406 lines)
|
||||
Version 14.77: Mar 04, 2015 New parameter "UsrNick" to go to a public user's profile. (178406 lines)
|
||||
Version 14.76.5: Mar 03, 2015 Added new social networks, suggested by Marta Gómez Macías. (178293 lines)
|
||||
1 change necessary in database:
|
||||
ALTER TABLE usr_webs CHANGE Web Web ENUM('www','500px','delicious','deviantart','edmodo','facebook','flickr','foursquare','github','googleplus','googlescholar','instagram','linkedin','paperli','pinterest','researchgate','scoopit','slideshare','storify','tumblr','twitter','wikipedia','youtube') NOT NULL;
|
||||
|
|
|
@ -2244,41 +2244,41 @@ mysql> DESCRIBE tst_tags;
|
|||
/***** Table usr_data *****/
|
||||
/*
|
||||
mysql> DESCRIBE usr_data;
|
||||
+-----------------+---------------------------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-----------------+---------------------------------+------+-----+---------+----------------+
|
||||
| UsrCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| EncryptedUsrCod | char(43) | NO | UNI | NULL | |
|
||||
| Password | char(86) | NO | | NULL | |
|
||||
| Surname1 | varchar(32) | NO | | NULL | |
|
||||
| Surname2 | varchar(32) | NO | | NULL | |
|
||||
| FirstName | varchar(32) | NO | | NULL | |
|
||||
| Sex | enum('unknown','female','male') | NO | | unknown | |
|
||||
| Layout | tinyint(4) | NO | MUL | 0 | |
|
||||
| Theme | char(16) | NO | MUL | NULL | |
|
||||
| IconSet | char(16) | NO | MUL | NULL | |
|
||||
| Language | char(2) | NO | MUL | NULL | |
|
||||
| Photo | char(43) | NO | | NULL | |
|
||||
| PublicPhoto | enum('N','Y') | NO | | N | |
|
||||
| CtyCod | int(11) | NO | MUL | -1 | |
|
||||
| InsCtyCod | int(11) | NO | MUL | -1 | |
|
||||
| InsCod | int(11) | NO | MUL | -1 | |
|
||||
| DptCod | int(11) | NO | MUL | -1 | |
|
||||
| CtrCod | int(11) | NO | MUL | -1 | |
|
||||
| Office | varchar(127) | NO | | NULL | |
|
||||
| OfficePhone | char(16) | NO | | NULL | |
|
||||
| LocalAddress | varchar(127) | NO | | NULL | |
|
||||
| LocalPhone | char(16) | NO | | NULL | |
|
||||
| FamilyAddress | varchar(127) | NO | | NULL | |
|
||||
| FamilyPhone | char(16) | NO | | NULL | |
|
||||
| OriginPlace | varchar(127) | NO | | NULL | |
|
||||
| Birthday | date | NO | | NULL | |
|
||||
| Comments | text | NO | | NULL | |
|
||||
| Menu | tinyint(4) | NO | MUL | 0 | |
|
||||
| SideCols | tinyint(4) | NO | MUL | 3 | |
|
||||
| NotifNtfEvents | int(11) | NO | | 0 | |
|
||||
| EmailNtfEvents | int(11) | NO | | 0 | |
|
||||
+-----------------+---------------------------------+------+-----+---------+----------------+
|
||||
+-----------------+----------------------------------------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-----------------+----------------------------------------+------+-----+---------+----------------+
|
||||
| UsrCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||
| EncryptedUsrCod | char(43) | NO | UNI | NULL | |
|
||||
| Password | char(86) | NO | | NULL | |
|
||||
| Surname1 | varchar(32) | NO | | NULL | |
|
||||
| Surname2 | varchar(32) | NO | | NULL | |
|
||||
| FirstName | varchar(32) | NO | | NULL | |
|
||||
| Sex | enum('unknown','female','male') | NO | | unknown | |
|
||||
| Layout | tinyint(4) | NO | MUL | 0 | |
|
||||
| Theme | char(16) | NO | MUL | NULL | |
|
||||
| IconSet | char(16) | NO | MUL | NULL | |
|
||||
| Language | char(2) | NO | MUL | NULL | |
|
||||
| Photo | char(43) | NO | | NULL | |
|
||||
| PhotoVisibility | enum('user','course','system','world') | NO | | user | |
|
||||
| CtyCod | int(11) | NO | MUL | -1 | |
|
||||
| InsCtyCod | int(11) | NO | MUL | -1 | |
|
||||
| InsCod | int(11) | NO | MUL | -1 | |
|
||||
| DptCod | int(11) | NO | MUL | -1 | |
|
||||
| CtrCod | int(11) | NO | MUL | -1 | |
|
||||
| Office | varchar(127) | NO | | NULL | |
|
||||
| OfficePhone | char(16) | NO | | NULL | |
|
||||
| LocalAddress | varchar(127) | NO | | NULL | |
|
||||
| LocalPhone | char(16) | NO | | NULL | |
|
||||
| FamilyAddress | varchar(127) | NO | | NULL | |
|
||||
| FamilyPhone | char(16) | NO | | NULL | |
|
||||
| OriginPlace | varchar(127) | NO | | NULL | |
|
||||
| Birthday | date | NO | | NULL | |
|
||||
| Comments | text | NO | | NULL | |
|
||||
| Menu | tinyint(4) | NO | MUL | 0 | |
|
||||
| SideCols | tinyint(4) | NO | MUL | 3 | |
|
||||
| NotifNtfEvents | int(11) | NO | | 0 | |
|
||||
| EmailNtfEvents | int(11) | NO | | 0 | |
|
||||
+-----------------+----------------------------------------+------+-----+---------+----------------+
|
||||
31 rows in set (0.00 sec)
|
||||
*/
|
||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_data ("
|
||||
|
@ -2294,7 +2294,7 @@ mysql> DESCRIBE usr_data;
|
|||
"IconSet CHAR(16) NOT NULL,"
|
||||
"Language CHAR(2) NOT NULL,"
|
||||
"Photo CHAR(43) NOT NULL,"
|
||||
"PublicPhoto ENUM('N','Y') NOT NULL DEFAULT 'N',"
|
||||
"PhotoVisibility ENUM('user','course','system','world') NOT NULL DEFAULT 'user',"
|
||||
"CtyCod INT NOT NULL DEFAULT -1,"
|
||||
"InsCtyCod INT NOT NULL DEFAULT -1,"
|
||||
"InsCod INT NOT NULL DEFAULT -1,"
|
||||
|
|
|
@ -370,8 +370,9 @@ void Enr_GetNotifEnrollment (char *SummaryStr,
|
|||
|
||||
void Enr_UpdateUsrData (struct UsrData *UsrDat)
|
||||
{
|
||||
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
|
||||
extern const char *The_ThemeId[The_NUM_THEMES];
|
||||
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
|
||||
extern const char *Pho_VisibilityDB[Pho_NUM_VISIBILITIES];
|
||||
extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES];
|
||||
extern const char *Usr_StringsSexDB[Usr_NUM_SEXS];
|
||||
char Query[2048];
|
||||
|
@ -387,7 +388,7 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
|
|||
sprintf (Query,"UPDATE usr_data"
|
||||
" SET Password='%s',"
|
||||
"Surname1='%s',Surname2='%s',FirstName='%s',Sex='%s',"
|
||||
"Layout='%u',Theme='%s',IconSet='%s',Language='%s',PublicPhoto='%c',"
|
||||
"Layout='%u',Theme='%s',IconSet='%s',Language='%s',PhotoVisibility='%s',"
|
||||
"CtyCod='%ld',"
|
||||
"LocalAddress='%s',LocalPhone='%s',FamilyAddress='%s',FamilyPhone='%s',OriginPlace='%s',Birthday='%04u-%02u-%02u',Comments='%s'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
|
@ -398,8 +399,7 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
|
|||
The_ThemeId[UsrDat->Prefs.Theme],
|
||||
Ico_IconSetId[UsrDat->Prefs.IconSet],
|
||||
Txt_STR_LANG_ID[UsrDat->Prefs.Language],
|
||||
UsrDat->PublicPhoto ? 'Y' :
|
||||
'N',
|
||||
Pho_VisibilityDB[UsrDat->PhotoVisibility],
|
||||
UsrDat->CtyCod,
|
||||
UsrDat->LocalAddress,UsrDat->LocalPhone,
|
||||
UsrDat->FamilyAddress,UsrDat->FamilyPhone,UsrDat->OriginPlace,
|
||||
|
|
161
swad_photo.c
161
swad_photo.c
|
@ -43,6 +43,7 @@
|
|||
#include "swad_logo.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_photo.h"
|
||||
#include "swad_photo_visibility.h"
|
||||
#include "swad_theme.h"
|
||||
#include "swad_user.h"
|
||||
|
||||
|
@ -52,6 +53,19 @@
|
|||
|
||||
extern struct Globals Gbl;
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/***** Photo visibility (who can see user's photo) *****/
|
||||
const char *Pho_VisibilityDB[Pho_NUM_VISIBILITIES] =
|
||||
{
|
||||
"user", // Pho_VISIBILITY_USER
|
||||
"course", // Pho_VISIBILITY_COURSE
|
||||
"system", // Pho_VISIBILITY_SYSTEM
|
||||
"world", // Pho_VISIBILITY_WORLD
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -84,7 +98,7 @@ static void Pho_UpdatePhoto1 (struct UsrData *UsrDat);
|
|||
static void Pho_UpdatePhoto2 (void);
|
||||
static void Pho_ClearPhotoName (long UsrCod);
|
||||
|
||||
static void Pho_PutFormPublicPhoto (void);
|
||||
static void Pho_PutFormPhotoVisibility (void);
|
||||
|
||||
static long Pho_GetDegWithAvgPhotoLeastRecentlyUpdated (void);
|
||||
static long Pho_GetTimeAvgPhotoWasComputed (long DegCod);
|
||||
|
@ -236,7 +250,8 @@ void Pho_ReqPhoto (const struct UsrData *UsrDat,bool PhotoExists,const char *Pho
|
|||
/***** Forms to remove photo and make it public *****/
|
||||
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
|
||||
Pho_PutLinkToRemoveUsrPhoto (UsrDat);
|
||||
Pho_PutFormPublicPhoto ();
|
||||
fprintf (Gbl.F.Out," ");
|
||||
Pho_PutFormPhotoVisibility ();
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/* Show photo */
|
||||
|
@ -774,29 +789,27 @@ void Pho_RemoveUsrFromTableClicksWithoutPhoto (long UsrCod)
|
|||
bool Pho_ShowUsrPhotoIsAllowed (struct UsrData *UsrDat,char *PhotoURL)
|
||||
{
|
||||
bool ICanSeePhoto = false;
|
||||
bool ItsMe = Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod;
|
||||
|
||||
/***** Check if I can see the other's photo *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod || // It's me
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
|
||||
// I always can see my photo
|
||||
// A superuser always can see any user's photo
|
||||
ICanSeePhoto = true;
|
||||
else if (Gbl.Usrs.Me.MaxRole == Rol_ROLE_STUDENT ||
|
||||
Gbl.Usrs.Me.MaxRole == Rol_ROLE_TEACHER ||
|
||||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
|
||||
switch (UsrDat->PhotoVisibility)
|
||||
{
|
||||
// If the maximum role of both users is student
|
||||
if (Gbl.Usrs.Me.MaxRole == Rol_ROLE_STUDENT && // My maximum role is student
|
||||
(UsrDat->Roles & (1 << Rol_ROLE_STUDENT)) && // He/she is a student in some courses...
|
||||
!(UsrDat->Roles & (1 << Rol_ROLE_TEACHER))) // ...but he/she is not a teacher in any course
|
||||
// A student only can see the photo of another student if both photos are public
|
||||
ICanSeePhoto = (Gbl.Usrs.Me.MyPhotoExists && // I have photo...
|
||||
Gbl.Usrs.Me.UsrDat.PublicPhoto && // ...and my photo is public...
|
||||
UsrDat->PublicPhoto); // ...and the other student' photo is also public
|
||||
else if (UsrDat->PublicPhoto) // The photo of the other user is public
|
||||
ICanSeePhoto = true;
|
||||
else
|
||||
ICanSeePhoto = Usr_CheckIfUsrSharesAnyOfMyCrs (UsrDat->UsrCod); // Both users share the same course
|
||||
case Pho_VISIBILITY_USER: // Only visible by me and my teachers if I am a student or me and my students if I am a teacher
|
||||
if (ItsMe || // I always can see my photo
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) // A system admin always can see any user's photo
|
||||
ICanSeePhoto = true;
|
||||
else
|
||||
ICanSeePhoto = Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (UsrDat->UsrCod); // Both users share the same course but whit different role
|
||||
break;
|
||||
case Pho_VISIBILITY_COURSE: // Visible by users sharing courses with me
|
||||
ICanSeePhoto = Usr_CheckIfUsrSharesAnyOfMyCrs (UsrDat->UsrCod); // Both users share the same course
|
||||
break;
|
||||
case Pho_VISIBILITY_SYSTEM: // Visible by any user logged in platform
|
||||
ICanSeePhoto = Gbl.Usrs.Me.Logged;
|
||||
break;
|
||||
case Pho_VISIBILITY_WORLD: // Public, visible by all the people, even unlogged visitors
|
||||
ICanSeePhoto = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/***** Photo is shown if I can see it, and it exists *****/
|
||||
|
@ -1009,59 +1022,105 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Select public / private photo ***********************/
|
||||
/************************** Select photo visibility **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Pho_PutFormPublicPhoto (void)
|
||||
static void Pho_PutFormPhotoVisibility (void)
|
||||
{
|
||||
extern const char *The_ClassFormul[The_NUM_THEMES];
|
||||
extern const char *Txt_Public_photo;
|
||||
|
||||
/***** Start form *****/
|
||||
Act_FormStart (ActChgPubPho);
|
||||
|
||||
/***** Checkbox to select between public or private photo *****/
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"PublicPhoto\" value=\"Y\"");
|
||||
if (Gbl.Usrs.Me.UsrDat.PublicPhoto)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onchange=\"javascript:document.getElementById('%s').submit();\" />"
|
||||
"<span class=\"%s\">%s</span>",
|
||||
Gbl.FormId,
|
||||
The_ClassFormul[Gbl.Prefs.Theme],Txt_Public_photo);
|
||||
/***** Select photo visibility *****/
|
||||
Pho_PutSelectorPhotoVisibility (true);
|
||||
|
||||
/***** End form *****/
|
||||
fprintf (Gbl.F.Out,"</form>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********** Get parameter with public / private photo from form **************/
|
||||
/************************** Select photo visibility **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Pho_GetParamPublicPhoto (void)
|
||||
void Pho_PutSelectorPhotoVisibility (bool SendOnChange)
|
||||
{
|
||||
char YN[1+1];
|
||||
extern const char *Txt_PHOTO_VISIBILITY[Pho_NUM_VISIBILITIES];
|
||||
Pho_Visibility_t PhotoVisibility;
|
||||
|
||||
Par_GetParToText ("PublicPhoto",YN,1);
|
||||
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
|
||||
/***** Select photo visibility *****/
|
||||
fprintf (Gbl.F.Out,"<select name=\"PhotoVisibility\" style=\"width:150px;\"");
|
||||
if (SendOnChange)
|
||||
fprintf (Gbl.F.Out," onchange=\"javascript:document.getElementById('%s').submit();\"",
|
||||
Gbl.FormId);
|
||||
fprintf (Gbl.F.Out,">");
|
||||
|
||||
for (PhotoVisibility = (Pho_Visibility_t) 0;
|
||||
PhotoVisibility < Pho_NUM_VISIBILITIES;
|
||||
PhotoVisibility++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) PhotoVisibility);
|
||||
if (PhotoVisibility == Gbl.Usrs.Me.UsrDat.PhotoVisibility)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",Txt_PHOTO_VISIBILITY[PhotoVisibility]);
|
||||
}
|
||||
|
||||
fprintf (Gbl.F.Out,"</select>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Change public / private photo ***********************/
|
||||
/************************* Get icon set from string **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pho_ChangePublicPhoto (void)
|
||||
Pho_Visibility_t Pho_GetPhotoVisibilityFromStr (const char *Str)
|
||||
{
|
||||
char Query[512];
|
||||
Pho_Visibility_t PhotoVisibility;
|
||||
|
||||
for (PhotoVisibility = (Pho_Visibility_t) 0;
|
||||
PhotoVisibility < Pho_NUM_VISIBILITIES;
|
||||
PhotoVisibility++)
|
||||
if (!strcasecmp (Str,Pho_VisibilityDB[PhotoVisibility]))
|
||||
return PhotoVisibility;
|
||||
|
||||
return Pho_VISIBILITY_DEFAULT;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Get parameter with photo visibility from form *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Pho_GetParamPhotoVisibility (void)
|
||||
{
|
||||
char UnsignedStr[10+1];
|
||||
unsigned UnsignedNum;
|
||||
|
||||
Par_GetParToText ("PhotoVisibility",UnsignedStr,10);
|
||||
if (UnsignedStr[0])
|
||||
{
|
||||
if (sscanf (UnsignedStr,"%u",&UnsignedNum) != 1)
|
||||
Lay_ShowErrorAndExit ("Photo visibility is missing.");
|
||||
if (UnsignedNum >= Pho_NUM_VISIBILITIES)
|
||||
Lay_ShowErrorAndExit ("Photo visibility is missing.");
|
||||
return (Pho_Visibility_t) UnsignedNum;
|
||||
}
|
||||
return Pho_VISIBILITY_DEFAULT;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Change photo visibility **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Pho_ChangePhotoVisibility (void)
|
||||
{
|
||||
char Query[128];
|
||||
|
||||
/***** Get param with public/private photo *****/
|
||||
Gbl.Usrs.Me.UsrDat.PublicPhoto = Pho_GetParamPublicPhoto ();
|
||||
Gbl.Usrs.Me.UsrDat.PhotoVisibility = Pho_GetParamPhotoVisibility ();
|
||||
|
||||
/***** Store public/private photo in database *****/
|
||||
sprintf (Query,"UPDATE usr_data SET PublicPhoto='%c' WHERE UsrCod='%ld'",
|
||||
Gbl.Usrs.Me.UsrDat.PublicPhoto ? 'Y' :
|
||||
'N',
|
||||
sprintf (Query,"UPDATE usr_data SET PhotoVisibility='%s'"
|
||||
" WHERE UsrCod='%ld'",
|
||||
Pho_VisibilityDB[Gbl.Usrs.Me.UsrDat.PhotoVisibility],
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
DB_QueryUPDATE (Query,"can not update your preference about public photo");
|
||||
DB_QueryUPDATE (Query,"can not update your preference about photo visibility");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1507,7 +1566,7 @@ static void Pho_PutSelectorForTypeOfAvg (void)
|
|||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) TypeOfAvg);
|
||||
if (TypeOfAvg == Gbl.Stat.DegPhotos.TypeOfAverage)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s",Txt_AVERAGE_PHOTO_TYPES[TypeOfAvg]);
|
||||
fprintf (Gbl.F.Out,">%s</option>",Txt_AVERAGE_PHOTO_TYPES[TypeOfAvg]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</form>"
|
||||
|
@ -1577,7 +1636,7 @@ static void Pho_PutSelectorForHowComputePhotoSize (void)
|
|||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) PhoSi);
|
||||
if (PhoSi == Gbl.Stat.DegPhotos.HowComputePhotoSize)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s",Txt_STAT_DEGREE_PHOTO_SIZE[PhoSi]);
|
||||
fprintf (Gbl.F.Out,">%s</option>",Txt_STAT_DEGREE_PHOTO_SIZE[PhoSi]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</form>"
|
||||
|
@ -1647,7 +1706,7 @@ static void Pho_PutSelectorForHowOrderDegrees (void)
|
|||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Order);
|
||||
if (Order == Gbl.Stat.DegPhotos.HowOrderDegrees)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s",Txt_STAT_DEGREE_PHOTO_ORDER[Order]);
|
||||
fprintf (Gbl.F.Out,">%s</option>",Txt_STAT_DEGREE_PHOTO_ORDER[Order]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</form>"
|
||||
|
|
|
@ -101,8 +101,10 @@ void Pho_UpdatePhotoName (struct UsrData *UsrDat);
|
|||
void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
|
||||
const char *ClassPhoto,bool Zoom);
|
||||
|
||||
bool Pho_GetParamPublicPhoto (void);
|
||||
void Pho_ChangePublicPhoto (void);
|
||||
void Pho_PutSelectorPhotoVisibility (bool SendOnChange);
|
||||
Pho_Visibility_t Pho_GetPhotoVisibilityFromStr (const char *Str);
|
||||
bool Pho_GetParamPhotoVisibility (void);
|
||||
void Pho_ChangePhotoVisibility (void);
|
||||
|
||||
void Pho_CalcPhotoDegree (void);
|
||||
void Pho_RemoveObsoleteStatDegrees (void);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
// swad_photo_visibility.h: Users' photo visibility
|
||||
|
||||
#ifndef _SWAD_PHO_VISIBILITY
|
||||
#define _SWAD_PHO_VISIBILITY
|
||||
/*
|
||||
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-2015 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 ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Public types and constants ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/***** Photo visibility (who can see user's photo) *****/
|
||||
#define Pho_NUM_VISIBILITIES 4
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Pho_VISIBILITY_USER = 0, // Only visible by me and my teachers if I am a student or my students if I am a teacher
|
||||
Pho_VISIBILITY_COURSE = 1, // Visible by users sharing courses with me
|
||||
Pho_VISIBILITY_SYSTEM = 2, // Visible by any user logged in platform
|
||||
Pho_VISIBILITY_WORLD = 3, // Public, visible by all the people, even unlogged visitors
|
||||
} Pho_Visibility_t;
|
||||
|
||||
#define Pho_VISIBILITY_DEFAULT Pho_VISIBILITY_USER
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif
|
|
@ -2024,8 +2024,7 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
|||
extern const char *Txt_Surname_1;
|
||||
extern const char *Txt_Surname_2;
|
||||
extern const char *Txt_First_name;
|
||||
extern const char *Txt_Private_Photo;
|
||||
extern const char *Txt_Public_photo;
|
||||
extern const char *Txt_PHOTO_VISIBILITY[Pho_NUM_VISIBILITIES];
|
||||
extern const char *Txt_Country;
|
||||
extern const char *Txt_Another_country;
|
||||
extern const char *Txt_Place_of_origin;
|
||||
|
@ -2348,16 +2347,10 @@ void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
|||
{
|
||||
fprintf (Gbl.F.Out,"<br />");
|
||||
if (TypeOfView == Rec_FORM_MY_COMMON_RECORD)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"PublicPhoto\" value=\"Y\"");
|
||||
if (UsrDat->PublicPhoto)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," /> %s",Txt_Public_photo);
|
||||
}
|
||||
/***** Select photo visibility *****/
|
||||
Pho_PutSelectorPhotoVisibility (false);
|
||||
else if (TypeOfView == Rec_MY_COMMON_RECORD_CHECK)
|
||||
fprintf (Gbl.F.Out,"%s",
|
||||
UsrDat->PublicPhoto ? Txt_Public_photo :
|
||||
Txt_Private_Photo);
|
||||
fprintf (Gbl.F.Out,"%s",Txt_PHOTO_VISIBILITY[UsrDat->PhotoVisibility]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
|
@ -3082,7 +3075,7 @@ void Rec_GetUsrExtraDataFromRecordForm (struct UsrData *UsrDat)
|
|||
UsrDat->Sex = (Usr_Sex_t) UnsignedNum;
|
||||
|
||||
/***** Get whether photo is public from form *****/
|
||||
UsrDat->PublicPhoto = Pho_GetParamPublicPhoto ();
|
||||
UsrDat->PhotoVisibility = Pho_GetParamPhotoVisibility ();
|
||||
|
||||
/***** Get country code *****/
|
||||
Par_GetParToText ("OthCtyCod",LongStr,1+10);
|
||||
|
|
197
swad_text.c
197
swad_text.c
|
@ -19341,9 +19341,9 @@ const char *Txt_MENU_SUBTITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] =
|
|||
#elif L==1
|
||||
"Profil"
|
||||
#elif L==2
|
||||
"A user's profile"
|
||||
"Public profile of a user"
|
||||
#elif L==3
|
||||
"Perfil de un usuario"
|
||||
"Perfil público de un usuario"
|
||||
#elif L==4
|
||||
"Profil"
|
||||
#elif L==5
|
||||
|
@ -26240,6 +26240,89 @@ const char *Txt_Photo_removed =
|
|||
"Photo removed."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_PHOTO_VISIBILITY[Pho_NUM_VISIBILITIES] =
|
||||
{ // Pho_VISIBILITY_USER
|
||||
#if L==0
|
||||
"Foto visible por mí y mis profesores / mis estudiantes" // Necessita traduccio
|
||||
#elif L==1
|
||||
"Photo visible by me and my teachers / my students" // Need Übersetzung
|
||||
#elif L==2
|
||||
"Photo visible by me and my teachers / my students"
|
||||
#elif L==3
|
||||
"Foto visible por mí y mis profesores / mis estudiantes"
|
||||
#elif L==4
|
||||
"Photo visible by me and my teachers / my students" // Besoin de traduction
|
||||
#elif L==5
|
||||
"Foto visible por mí y mis profesores / mis estudiantes" // Okoteve traducción
|
||||
#elif L==6
|
||||
"Photo visible by me and my teachers / my students" // Bisogno di traduzione
|
||||
#elif L==7
|
||||
"Photo visible by me and my teachers / my students" // Potrzebujesz tlumaczenie
|
||||
#elif L==8
|
||||
"Photo visible by me and my teachers / my students" // Necessita de tradução
|
||||
#endif
|
||||
, // Pho_VISIBILITY_COURSE
|
||||
#if L==0
|
||||
"Foto visible por usuarios de mis asignaturas" // Necessita traduccio
|
||||
#elif L==1
|
||||
"Photo visible by users in my courses" // Need Übersetzung
|
||||
#elif L==2
|
||||
"Photo visible by users in my courses"
|
||||
#elif L==3
|
||||
"Foto visible por usuarios de mis asignaturas"
|
||||
#elif L==4
|
||||
"Photo visible by users in my courses" // Besoin de traduction
|
||||
#elif L==5
|
||||
"Foto visible por usuarios de mis asignaturas" // Okoteve traducción
|
||||
#elif L==6
|
||||
"Photo visible by users in my courses" // Bisogno di traduzione
|
||||
#elif L==7
|
||||
"Photo visible by users in my courses" // Potrzebujesz tlumaczenie
|
||||
#elif L==8
|
||||
"Photo visible by users in my courses" // Necessita de tradução
|
||||
#endif
|
||||
, // Pho_VISIBILITY_SYSTEM
|
||||
#if L==0
|
||||
"Foto visible por cualquier usuario identificado" // Necessita traduccio
|
||||
#elif L==1
|
||||
"Photo visible by any logged user" // Need Übersetzung
|
||||
#elif L==2
|
||||
"Photo visible by any logged user"
|
||||
#elif L==3
|
||||
"Foto visible por cualquier usuario identificado"
|
||||
#elif L==4
|
||||
"Photo visible by any logged user" // Besoin de traduction
|
||||
#elif L==5
|
||||
"Foto visible por cualquier usuario identificado" // Okoteve traducción
|
||||
#elif L==6
|
||||
"Photo visible by any logged user" // Bisogno di traduzione
|
||||
#elif L==7
|
||||
"Photo visible by any logged user" // Potrzebujesz tlumaczenie
|
||||
#elif L==8
|
||||
"Photo visible by any logged user" // Necessita de tradução
|
||||
#endif
|
||||
, // Pho_VISIBILITY_WORLD
|
||||
#if L==0
|
||||
"Foto pública, visible por todo el mundo" // Necessita traduccio
|
||||
#elif L==1
|
||||
"Public photo, visible by everyone" // Need Übersetzung
|
||||
#elif L==2
|
||||
"Public photo, visible by everyone"
|
||||
#elif L==3
|
||||
"Foto pública, visible por todo el mundo"
|
||||
#elif L==4
|
||||
"Public photo, visible by everyone" // Besoin de traduction
|
||||
#elif L==5
|
||||
"Foto pública, visible por todo el mundo" // Okoteve traducción
|
||||
#elif L==6
|
||||
"Public photo, visible by everyone" // Bisogno di traduzione
|
||||
#elif L==7
|
||||
"Public photo, visible by everyone" // Potrzebujesz tlumaczenie
|
||||
#elif L==8
|
||||
"Public photo, visible by everyone" // Necessita de tradução
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *Txt_photos =
|
||||
#if L==0
|
||||
"fotos";
|
||||
|
@ -26944,27 +27027,6 @@ const char *Txt_posts =
|
|||
"posts";
|
||||
#endif
|
||||
|
||||
const char *Txt_Public_photo =
|
||||
#if L==0
|
||||
"Foto pública";
|
||||
#elif L==1
|
||||
"Öffentliches Foto";
|
||||
#elif L==2
|
||||
"Public photo";
|
||||
#elif L==3
|
||||
"Foto pública";
|
||||
#elif L==4
|
||||
"Photo public";
|
||||
#elif L==5
|
||||
"Foto pública"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Foto pubblica";
|
||||
#elif L==7
|
||||
"Zdjęcie publiczne";
|
||||
#elif L==8
|
||||
"Foto pública";
|
||||
#endif
|
||||
|
||||
const char *Txt_Public_open_educational_resource_OER_for_everyone =
|
||||
#if L==0
|
||||
"Públic, recurs educatiu obert (OER) per a tothom";
|
||||
|
@ -44556,75 +44618,6 @@ const char *Txt_To_remove_an_institution_you_must_first_remove_all_centres_and_u
|
|||
" all centres and users in the institution."; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_to_see_photos_of_others_you_have_to_allow_others_to_see_your_photo_you_can_do_it_in_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"para ver las fotos de otros,"
|
||||
" tiene que permitir que otros vean la suya;"
|
||||
" puede hacerlo en %s"; // Necessita traduccio
|
||||
#elif L==1
|
||||
"to see photos of others,"
|
||||
" you have to allow others to see your photo;"
|
||||
" you can do it in %s"; // Need Übersetzung
|
||||
#elif L==2
|
||||
"to see photos of others,"
|
||||
" you have to allow others to see your photo;"
|
||||
" you can do it in %s";
|
||||
#elif L==3
|
||||
"para ver las fotos de otros,"
|
||||
" tiene que permitir que otros vean la suya;"
|
||||
" puede hacerlo en %s";
|
||||
#elif L==4
|
||||
"to see photos of others,"
|
||||
" you have to allow others to see your photo;"
|
||||
" you can do it in %s"; // Besoin de traduction
|
||||
#elif L==5
|
||||
"para ver las fotos de otros,"
|
||||
" tiene que permitir que otros vean la suya;"
|
||||
" puede hacerlo en %s"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"per vedere le foto di altri,"
|
||||
" devi permettere agli altri di vedere la tua foto;"
|
||||
" puoi farlo in %s";
|
||||
#elif L==7
|
||||
"to see photos of others,"
|
||||
" you have to allow others to see your photo;"
|
||||
" you can do it in %s"; // Potrzebujesz tlumaczenie
|
||||
#elif L==8
|
||||
"to see photos of others,"
|
||||
" you have to allow others to see your photo;"
|
||||
" you can do it in %s"; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_to_see_photos_of_others_you_have_to_send_your_photo_you_can_do_it_in_X = // Warning: it is very important to include %s in the following sentences
|
||||
#if L==0
|
||||
"para ver las fotos de otros, tiene que enviar la suya;"
|
||||
" puede hacerlo en %s"; // Necessita traduccio
|
||||
#elif L==1
|
||||
"to see photos of others, you have to send your photo;"
|
||||
" you can do it in %s"; // Need Übersetzung
|
||||
#elif L==2
|
||||
"to see photos of others, you have to send your photo;"
|
||||
" you can do it in %s";
|
||||
#elif L==3
|
||||
"para ver las fotos de otros, tiene que enviar la suya;"
|
||||
" puede hacerlo en %s";
|
||||
#elif L==4
|
||||
"to see photos of others, you have to send your photo;"
|
||||
" you can do it in %s"; // Besoin de traduction
|
||||
#elif L==5
|
||||
"para ver las fotos de otros, tiene que enviar la suya;"
|
||||
" puede hacerlo en %s"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"per vedere le foto di altri, devi inviare la tua foto;"
|
||||
" puoi farlo in %s";
|
||||
#elif L==7
|
||||
"to see photos of others, you have to send your photo;"
|
||||
" you can do it in %s"; // Potrzebujesz tlumaczenie
|
||||
#elif L==8
|
||||
"to see photos of others, you have to send your photo;"
|
||||
" you can do it in %s"; // Necessita de tradução
|
||||
#endif
|
||||
|
||||
const char *Txt_To_use_chat_you_must_have_installed_the_software_X_and_add_Y_ = // Warning: it is very important to include three %s in the following sentences
|
||||
#if L==0
|
||||
"Per utilitzar el xat cal tenir instal lat el programari"
|
||||
|
@ -46765,25 +46758,25 @@ const char *Txt_View =
|
|||
"Ver";
|
||||
#endif
|
||||
|
||||
const char *Txt_View_a_user_profile =
|
||||
const char *Txt_View_a_user_public_profile =
|
||||
#if L==0
|
||||
"Veure el perfil d'un usuari";
|
||||
"Veure el perfil públic d'un usuari";
|
||||
#elif L==1
|
||||
"Benutzer-Profile anzeigen";
|
||||
"Öffentliches Benutzer-Profile anzeigen";
|
||||
#elif L==2
|
||||
"View a user's profile";
|
||||
"View a user's public profile";
|
||||
#elif L==3
|
||||
"Ver el perfil de un usuario";
|
||||
"Ver el perfil público de un usuario";
|
||||
#elif L==4
|
||||
"Voir le profil d'un utilisateur";
|
||||
"Voir le profil public d'un utilisateur";
|
||||
#elif L==5
|
||||
"Ver el perfil de un usuario"; // Okoteve traducción
|
||||
"Ver el perfil público de un usuario"; // Okoteve traducción
|
||||
#elif L==6
|
||||
"Mostra il profilo di un utente";
|
||||
"Mostra il profilo pubblico di un utente";
|
||||
#elif L==7
|
||||
"Zobacz profil użytkownika";
|
||||
"Zobacz profil publiczny użytkownika";
|
||||
#elif L==8
|
||||
"Ver o perfil de um utilizador";
|
||||
"Ver o perfil público de um utilizador";
|
||||
#endif
|
||||
|
||||
const char *Txt_View_all_recipients =
|
||||
|
|
87
swad_user.c
87
swad_user.c
|
@ -238,7 +238,7 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
|
|||
UsrDat->EmailConfirmed = false;
|
||||
|
||||
UsrDat->Photo[0] = '\0';
|
||||
UsrDat->PublicPhoto = false;
|
||||
UsrDat->PhotoVisibility = Pho_VISIBILITY_DEFAULT;
|
||||
|
||||
UsrDat->CtyCod = -1L;
|
||||
UsrDat->OriginPlace[0] = '\0';
|
||||
|
@ -383,13 +383,12 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
The_Theme_t Theme;
|
||||
Ico_IconSet_t IconSet;
|
||||
Txt_Language_t Lan;
|
||||
char YN[1+1];
|
||||
char StrBirthday[4+1+2+1+2+1];
|
||||
unsigned UnsignedNum;
|
||||
char StrBirthday[4+1+2+1+2+1];
|
||||
|
||||
/***** Get user's data from database *****/
|
||||
sprintf (Query,"SELECT EncryptedUsrCod,Password,Surname1,Surname2,FirstName,Sex,"
|
||||
"Layout,Theme,IconSet,Language,Photo,PublicPhoto,"
|
||||
"Layout,Theme,IconSet,Language,Photo,PhotoVisibility,"
|
||||
"CtyCod,InsCtyCod,InsCod,DptCod,CtrCod,Office,OfficePhone,"
|
||||
"LocalAddress,LocalPhone,FamilyAddress,FamilyPhone,OriginPlace,Birthday,Comments,"
|
||||
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents"
|
||||
|
@ -468,23 +467,22 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
|
|||
}
|
||||
|
||||
/* Get rest of data */
|
||||
strncpy (UsrDat->Photo ,row[10],sizeof (UsrDat->Photo )-1);
|
||||
strncpy (YN ,row[11],1);
|
||||
UsrDat->PublicPhoto = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
|
||||
strncpy (UsrDat->Photo,row[10],sizeof (UsrDat->Photo)-1);
|
||||
UsrDat->PhotoVisibility = Pho_GetPhotoVisibilityFromStr (row[11]);
|
||||
UsrDat->CtyCod = Str_ConvertStrCodToLongCod (row[12]);
|
||||
UsrDat->InsCtyCod = Str_ConvertStrCodToLongCod (row[13]);
|
||||
UsrDat->InsCod = Str_ConvertStrCodToLongCod (row[14]);
|
||||
|
||||
UsrDat->Tch.DptCod = Str_ConvertStrCodToLongCod (row[15]);
|
||||
UsrDat->Tch.CtrCod = Str_ConvertStrCodToLongCod (row[16]);
|
||||
strncpy (UsrDat->Tch.Office ,row[17],sizeof (UsrDat->Tch.Office )-1);
|
||||
strncpy (UsrDat->Tch.OfficePhone ,row[18],sizeof (UsrDat->Tch.OfficePhone )-1);
|
||||
strncpy (UsrDat->Tch.Office ,row[17],sizeof (UsrDat->Tch.Office )-1);
|
||||
strncpy (UsrDat->Tch.OfficePhone,row[18],sizeof (UsrDat->Tch.OfficePhone)-1);
|
||||
|
||||
strncpy (UsrDat->LocalAddress ,row[19],sizeof (UsrDat->LocalAddress )-1);
|
||||
strncpy (UsrDat->LocalPhone ,row[20],sizeof (UsrDat->LocalPhone )-1);
|
||||
strncpy (UsrDat->FamilyAddress,row[21],sizeof (UsrDat->FamilyAddress)-1);
|
||||
strncpy (UsrDat->FamilyPhone ,row[22],sizeof (UsrDat->FamilyPhone )-1);
|
||||
strncpy (UsrDat->OriginPlace ,row[23],sizeof (UsrDat->OriginPlace )-1);
|
||||
strncpy (UsrDat->LocalAddress ,row[19],sizeof (UsrDat->LocalAddress )-1);
|
||||
strncpy (UsrDat->LocalPhone ,row[20],sizeof (UsrDat->LocalPhone )-1);
|
||||
strncpy (UsrDat->FamilyAddress ,row[21],sizeof (UsrDat->FamilyAddress )-1);
|
||||
strncpy (UsrDat->FamilyPhone ,row[22],sizeof (UsrDat->FamilyPhone )-1);
|
||||
strncpy (UsrDat->OriginPlace ,row[23],sizeof (UsrDat->OriginPlace )-1);
|
||||
strcpy (StrBirthday,
|
||||
row[24] ? row[24] :
|
||||
"0000-00-00");
|
||||
|
@ -735,11 +733,30 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (long UsrCod)
|
|||
|
||||
/***** Get if a user shares any course with me from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM crs_usr WHERE UsrCod='%ld'"
|
||||
" AND CrsCod IN (SELECT CrsCod FROM crs_usr WHERE UsrCod='%ld')",
|
||||
" AND CrsCod IN"
|
||||
" (SELECT CrsCod FROM crs_usr WHERE UsrCod='%ld')",
|
||||
UsrCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user shares any course with you") != 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Check if a user belongs to any of my courses but has a different role ***/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Get if a user shares any course with me from database *****/
|
||||
sprintf (Query,"SELECT COUNT(*) FROM"
|
||||
"(SELECT CrsCod,Role FROM crs_usr WHERE UsrCod='%ld') AS my_courses,"
|
||||
"(SELECT CrsCod,Role FROM crs_usr WHERE UsrCod='%ld') AS usr_courses"
|
||||
" WHERE my_courses.CrsCod=usr_courses.CrsCod"
|
||||
" AND my_courses.Role!=usr_courses.Role",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,UsrCod);
|
||||
return (DB_QueryCOUNT (Query,"can not check if a user shares any course with you") != 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/** Get all my institutions (those of my courses) and store them in a list ***/
|
||||
/*****************************************************************************/
|
||||
|
@ -6800,19 +6817,11 @@ void Usr_SeeTchClassPhotoPrn (void)
|
|||
static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
|
||||
Rol_Role_t RoleInClassPhoto)
|
||||
{
|
||||
extern const char *Txt_to_see_photos_of_others_you_have_to_allow_others_to_see_your_photo_you_can_do_it_in_X;
|
||||
extern const char *Txt_to_see_photos_of_others_you_have_to_send_your_photo_you_can_do_it_in_X;
|
||||
struct ListUsers *LstUsrs;
|
||||
unsigned NumUsr;
|
||||
bool TRIsOpen = false;
|
||||
bool IAmLoggedAsTeacherOrAbove = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
|
||||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
|
||||
bool ICanSeePhotos = (IAmLoggedAsTeacherOrAbove ||
|
||||
(Gbl.Usrs.Me.MyPhotoExists &&
|
||||
Gbl.Usrs.Me.UsrDat.PublicPhoto));
|
||||
bool PutCheckBoxToSelectUsr = (ClassPhotoType == Usr_CLASS_PHOTO_SEL ||
|
||||
ClassPhotoType == Usr_CLASS_PHOTO_SEL_SEE);
|
||||
ClassPhotoType == Usr_CLASS_PHOTO_SEL_SEE);
|
||||
bool PutOriginPlace = (RoleInClassPhoto == Rol_ROLE_STUDENT &&
|
||||
(ClassPhotoType == Usr_CLASS_PHOTO_SEL_SEE ||
|
||||
ClassPhotoType == Usr_CLASS_PHOTO_SEE ||
|
||||
|
@ -6824,7 +6833,6 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
|
|||
const char *ClassPhoto = "PHOTO18x24"; // Default photo size
|
||||
int LengthUsrData = 10; // Maximum number of characters of user data
|
||||
char PhotoURL[PATH_MAX+1];
|
||||
char BreadcrumbStr[512];
|
||||
struct UsrData UsrDat;
|
||||
|
||||
/***** Show guests, students or teachers? *****/
|
||||
|
@ -6970,31 +6978,6 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
|
|||
|
||||
/***** Free memory used for user's data *****/
|
||||
Usr_UsrDataDestructor (&UsrDat);
|
||||
|
||||
/***** Write message in case of the user can not view the photos of others *****/
|
||||
if (!ICanSeePhotos && RoleInClassPhoto == Rol_ROLE_STUDENT &&
|
||||
ClassPhotoType != Usr_CLASS_PHOTO_PRN)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td colspan=\"%d\" class=\"MSJ_AVISO\""
|
||||
" style=\"text-align:center;\">"
|
||||
"(",
|
||||
Gbl.Usrs.ClassPhoto.Cols);
|
||||
if (Gbl.Usrs.Me.MyPhotoExists)
|
||||
{
|
||||
Act_GetBreadcrumbStrForAction (ActEdiPrf,true,BreadcrumbStr);
|
||||
fprintf (Gbl.F.Out,Txt_to_see_photos_of_others_you_have_to_allow_others_to_see_your_photo_you_can_do_it_in_X,
|
||||
BreadcrumbStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
Act_GetBreadcrumbStrForAction (ActReqMyPho,true,BreadcrumbStr);
|
||||
fprintf (Gbl.F.Out,Txt_to_see_photos_of_others_you_have_to_send_your_photo_you_can_do_it_in_X,
|
||||
BreadcrumbStr);
|
||||
}
|
||||
fprintf (Gbl.F.Out,")</td>"
|
||||
"</tr>");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -7363,13 +7346,13 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
|
|||
|
||||
void Usr_RequestUserProfile (void)
|
||||
{
|
||||
extern const char *Txt_View_a_user_profile;
|
||||
extern const char *Txt_View_a_user_public_profile;
|
||||
extern const char *The_ClassFormul[The_NUM_THEMES];
|
||||
extern const char *Txt_Nickname;
|
||||
extern const char *Txt_Continue;
|
||||
|
||||
/***** Start frame *****/
|
||||
Lay_StartRoundFrameTable10 (NULL,2,Txt_View_a_user_profile);
|
||||
Lay_StartRoundFrameTable10 (NULL,2,Txt_View_a_user_public_profile);
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td>");
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "swad_layout.h"
|
||||
#include "swad_menu.h"
|
||||
#include "swad_nickname.h"
|
||||
#include "swad_photo_visibility.h"
|
||||
#include "swad_role.h"
|
||||
#include "swad_scope.h"
|
||||
#include "swad_search.h"
|
||||
|
@ -126,7 +127,7 @@ struct UsrData
|
|||
char Email [Cns_MAX_BYTES_STRING +1];
|
||||
bool EmailConfirmed;
|
||||
char Photo [Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+1]; // Name of public link to photo
|
||||
bool PublicPhoto; // User want his photo to be public?
|
||||
Pho_Visibility_t PhotoVisibility; // Who can see user's photo
|
||||
long CtyCod; // Country
|
||||
char OriginPlace [Cns_MAX_BYTES_STRING+1];
|
||||
struct Date Birthday;
|
||||
|
@ -209,6 +210,7 @@ void Usr_RestrictLengthAndWriteName (struct UsrData *UsrDat,unsigned MaxChars);
|
|||
bool Usr_CheckIfUsrIsAdm (long UsrCod,Sco_Scope_t Scope,long Cod);
|
||||
bool Usr_CheckIfUsrIsSuperuser (long UsrCod);
|
||||
bool Usr_CheckIfUsrSharesAnyOfMyCrs (long UsrCod);
|
||||
bool Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod);
|
||||
void Usr_GetMyInstitutions (void);
|
||||
void Usr_GetMyCentres (void);
|
||||
void Usr_GetMyDegrees (void);
|
||||
|
|
Loading…
Reference in New Issue