Version 14.79.1

This commit is contained in:
Antonio Cañas Vargas 2015-03-06 23:20:33 +01:00
parent ba95e29ea9
commit a509c959d7
13 changed files with 204 additions and 136 deletions

View File

@ -1126,6 +1126,7 @@ CREATE TABLE IF NOT EXISTS usr_data (
Language CHAR(2) NOT NULL,
Photo CHAR(43) NOT NULL,
PhotoVisibility ENUM('user','course','system','world') NOT NULL DEFAULT 'user',
ProfileVisibility 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,

View File

@ -432,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,PhotoVisibility,"
"Layout,Theme,IconSet,Language,PhotoVisibility,ProfileVisibility,"
"CtyCod,"
"LocalAddress,LocalPhone,FamilyAddress,FamilyPhone,OriginPlace,Birthday,Comments,"
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents)"
" VALUES ('%s','%s','%s','%s','%s','%s',"
"'%u','%s','%s','%s','%s',"
"'%u','%s','%s','%s','%s','%s',"
"'%ld',"
"'%s','%s','%s','%s','%s','%04u-%02u-%02u','%s',"
"'%u','%u','-1','0')",
@ -450,6 +450,7 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat)
Ico_IconSetId[UsrDat->Prefs.IconSet],
Txt_STR_LANG_ID[UsrDat->Prefs.Language],
Pri_VisibilityDB[UsrDat->PhotoVisibility],
Pri_VisibilityDB[UsrDat->ProfileVisibility],
UsrDat->CtyCod,
UsrDat->LocalAddress ,UsrDat->LocalPhone,
UsrDat->FamilyAddress,UsrDat->FamilyPhone,

View File

@ -1180,9 +1180,10 @@ Profile:
951. ActDetMyPho Receive my photo and detect faces on it
952. ActUpdMyPho Update my photo
953. ActRemMyPho Remove my photo
954. ActChgPubPho Change photo privacy
---. ActEdiPri Edit my privacy
954. ActChgPriPho Change privacy of my photo
---. ActChgPriPrf Change privacy of my public profile
955. ActReqEdiMyIns Request the edition of my institution, centre and department
956. ActChgCtyMyIns Change the country of my institution
@ -2593,9 +2594,10 @@ 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,NULL ,Pho_ChangePhotoVisibility ,NULL},
/* ActEdiPri */{1403,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pri_EditMyPrivacy ,NULL},
/* ActChgPriPho */{ 774,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Pho_ChangePhotoVisibility ,NULL},
/* ActChgPriPrf */{1404,-1,TabPrf,ActReqEdiRecCom ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Usr_ChangeProfileVisibility ,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},
@ -3423,7 +3425,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
-1, // #771 (obsolete action)
ActDelPstForInsTch, // #772
ActRemOldUsr, // #773
ActChgPubPho, // #774
ActChgPriPho, // #774
ActChgNtfPrf, // #775
ActRemPlc, // #776
ActLstPlg, // #777
@ -4056,6 +4058,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActReqPubPrf, // #1401
ActSeePubPrf, // #1402
ActEdiPri, // #1403
ActChgPriPrf, // #1404
};
/*****************************************************************************/

View File

@ -69,9 +69,9 @@ typedef enum
typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_NUM_ACTIONS (7+52+15+90+73+68+204+184+100+168+28+76)
#define Act_NUM_ACTIONS (7+52+15+90+73+68+204+184+100+168+28+77)
#define Act_MAX_ACTION_COD 1403
#define Act_MAX_ACTION_COD 1404
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
@ -1228,57 +1228,58 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
#define ActDetMyPho (ActSeeAllStaCrs+29)
#define ActUpdMyPho (ActSeeAllStaCrs+30)
#define ActRemMyPho (ActSeeAllStaCrs+31)
#define ActChgPubPho (ActSeeAllStaCrs+32)
#define ActEdiPri (ActSeeAllStaCrs+33)
#define ActEdiPri (ActSeeAllStaCrs+32)
#define ActChgPriPho (ActSeeAllStaCrs+33)
#define ActChgPriPrf (ActSeeAllStaCrs+34)
#define ActReqEdiMyIns (ActSeeAllStaCrs+34)
#define ActChgCtyMyIns (ActSeeAllStaCrs+35)
#define ActChgMyIns (ActSeeAllStaCrs+36)
#define ActChgMyCtr (ActSeeAllStaCrs+37)
#define ActChgMyDpt (ActSeeAllStaCrs+38)
#define ActChgMyOff (ActSeeAllStaCrs+39)
#define ActChgMyOffPho (ActSeeAllStaCrs+40)
#define ActReqEdiMyIns (ActSeeAllStaCrs+35)
#define ActChgCtyMyIns (ActSeeAllStaCrs+36)
#define ActChgMyIns (ActSeeAllStaCrs+37)
#define ActChgMyCtr (ActSeeAllStaCrs+38)
#define ActChgMyDpt (ActSeeAllStaCrs+39)
#define ActChgMyOff (ActSeeAllStaCrs+40)
#define ActChgMyOffPho (ActSeeAllStaCrs+41)
#define ActReqEdiMyNet (ActSeeAllStaCrs+41)
#define ActChgMyNet (ActSeeAllStaCrs+42)
#define ActReqEdiMyNet (ActSeeAllStaCrs+42)
#define ActChgMyNet (ActSeeAllStaCrs+43)
#define ActChgLay (ActSeeAllStaCrs+43)
#define ActChgThe (ActSeeAllStaCrs+44)
#define ActReqChgLan (ActSeeAllStaCrs+45)
#define ActChgLan (ActSeeAllStaCrs+46)
#define ActChgCol (ActSeeAllStaCrs+47)
#define ActHidLftCol (ActSeeAllStaCrs+48)
#define ActHidRgtCol (ActSeeAllStaCrs+49)
#define ActShoLftCol (ActSeeAllStaCrs+50)
#define ActShoRgtCol (ActSeeAllStaCrs+51)
#define ActChgIco (ActSeeAllStaCrs+52)
#define ActChgMnu (ActSeeAllStaCrs+53)
#define ActChgNtfPrf (ActSeeAllStaCrs+54)
#define ActChgLay (ActSeeAllStaCrs+44)
#define ActChgThe (ActSeeAllStaCrs+45)
#define ActReqChgLan (ActSeeAllStaCrs+46)
#define ActChgLan (ActSeeAllStaCrs+47)
#define ActChgCol (ActSeeAllStaCrs+48)
#define ActHidLftCol (ActSeeAllStaCrs+49)
#define ActHidRgtCol (ActSeeAllStaCrs+50)
#define ActShoLftCol (ActSeeAllStaCrs+51)
#define ActShoRgtCol (ActSeeAllStaCrs+52)
#define ActChgIco (ActSeeAllStaCrs+53)
#define ActChgMnu (ActSeeAllStaCrs+54)
#define ActChgNtfPrf (ActSeeAllStaCrs+55)
#define ActPrnUsrQR (ActSeeAllStaCrs+55)
#define ActPrnUsrQR (ActSeeAllStaCrs+56)
#define ActPrnMyTimTbl (ActSeeAllStaCrs+56)
#define ActEdiTut (ActSeeAllStaCrs+57)
#define ActChgTut (ActSeeAllStaCrs+58)
#define ActReqRemFilBrf (ActSeeAllStaCrs+59)
#define ActRemFilBrf (ActSeeAllStaCrs+60)
#define ActRemFolBrf (ActSeeAllStaCrs+61)
#define ActCopBrf (ActSeeAllStaCrs+62)
#define ActPasBrf (ActSeeAllStaCrs+63)
#define ActRemTreBrf (ActSeeAllStaCrs+64)
#define ActFrmCreBrf (ActSeeAllStaCrs+65)
#define ActCreFolBrf (ActSeeAllStaCrs+66)
#define ActCreLnkBrf (ActSeeAllStaCrs+67)
#define ActRenFolBrf (ActSeeAllStaCrs+68)
#define ActRcvFilBrfDZ (ActSeeAllStaCrs+69)
#define ActRcvFilBrfCla (ActSeeAllStaCrs+70)
#define ActExpBrf (ActSeeAllStaCrs+71)
#define ActConBrf (ActSeeAllStaCrs+72)
#define ActZIPBrf (ActSeeAllStaCrs+73)
#define ActReqDatBrf (ActSeeAllStaCrs+74)
#define ActChgDatBrf (ActSeeAllStaCrs+75)
#define ActDowBrf (ActSeeAllStaCrs+76)
#define ActPrnMyTimTbl (ActSeeAllStaCrs+57)
#define ActEdiTut (ActSeeAllStaCrs+58)
#define ActChgTut (ActSeeAllStaCrs+59)
#define ActReqRemFilBrf (ActSeeAllStaCrs+60)
#define ActRemFilBrf (ActSeeAllStaCrs+61)
#define ActRemFolBrf (ActSeeAllStaCrs+62)
#define ActCopBrf (ActSeeAllStaCrs+63)
#define ActPasBrf (ActSeeAllStaCrs+64)
#define ActRemTreBrf (ActSeeAllStaCrs+65)
#define ActFrmCreBrf (ActSeeAllStaCrs+66)
#define ActCreFolBrf (ActSeeAllStaCrs+67)
#define ActCreLnkBrf (ActSeeAllStaCrs+68)
#define ActRenFolBrf (ActSeeAllStaCrs+69)
#define ActRcvFilBrfDZ (ActSeeAllStaCrs+70)
#define ActRcvFilBrfCla (ActSeeAllStaCrs+71)
#define ActExpBrf (ActSeeAllStaCrs+72)
#define ActConBrf (ActSeeAllStaCrs+73)
#define ActZIPBrf (ActSeeAllStaCrs+74)
#define ActReqDatBrf (ActSeeAllStaCrs+75)
#define ActChgDatBrf (ActSeeAllStaCrs+76)
#define ActDowBrf (ActSeeAllStaCrs+77)
/*****************************************************************************/
/******************************** Public types *******************************/

View File

@ -103,11 +103,18 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.79 (2015/03/06)"
#define Log_PLATFORM_VERSION "SWAD 14.79.1 (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.79.1: Mar 06, 2015 Add options to change visibility of public profile. (178769 lines)
3 changes necessary in database:
ALTER TABLE usr_data ADD COLUMN ProfileVisibility ENUM('user','course','system','world') NOT NULL DEFAULT 'user' AFTER PhotoVisibility;
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1403','es','N','Editar privacidad');
INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1404','es','N','Cambiar privacidad perfil público');
Version 14.79: Mar 06, 2015 New module swad_privacy. (178678 lines)
1 change necessary in Makefile:
Add swad_privacy.o to list of object files

View File

@ -2244,42 +2244,43 @@ 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 | |
| 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)
+-------------------+----------------------------------------+------+-----+---------+----------------+
| 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 | |
| ProfileVisibility | 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 | |
+-------------------+----------------------------------------+------+-----+---------+----------------+
32 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_data ("
"UsrCod INT NOT NULL AUTO_INCREMENT,"
@ -2295,6 +2296,7 @@ mysql> DESCRIBE usr_data;
"Language CHAR(2) NOT NULL,"
"Photo CHAR(43) NOT NULL,"
"PhotoVisibility ENUM('user','course','system','world') NOT NULL DEFAULT 'user',"
"ProfileVisibility 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,"

View File

@ -388,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',PhotoVisibility='%s',"
"Layout='%u',Theme='%s',IconSet='%s',Language='%s',PhotoVisibility='%s',ProfileVisibility='%s',"
"CtyCod='%ld',"
"LocalAddress='%s',LocalPhone='%s',FamilyAddress='%s',FamilyPhone='%s',OriginPlace='%s',Birthday='%04u-%02u-%02u',Comments='%s'"
" WHERE UsrCod='%ld'",
@ -400,6 +400,7 @@ void Enr_UpdateUsrData (struct UsrData *UsrDat)
Ico_IconSetId[UsrDat->Prefs.IconSet],
Txt_STR_LANG_ID[UsrDat->Prefs.Language],
Pri_VisibilityDB[UsrDat->PhotoVisibility],
Pri_VisibilityDB[UsrDat->ProfileVisibility],
UsrDat->CtyCod,
UsrDat->LocalAddress,UsrDat->LocalPhone,
UsrDat->FamilyAddress,UsrDat->FamilyPhone,UsrDat->OriginPlace,

View File

@ -776,29 +776,10 @@ 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;
bool ICanSeePhoto;
/***** Check if I can see the other's photo *****/
switch (UsrDat->PhotoVisibility)
{
case Pri_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 Pri_VISIBILITY_COURSE: // Visible by users sharing courses with me
ICanSeePhoto = Usr_CheckIfUsrSharesAnyOfMyCrs (UsrDat->UsrCod); // Both users share the same course
break;
case Pri_VISIBILITY_SYSTEM: // Visible by any user logged in platform
ICanSeePhoto = Gbl.Usrs.Me.Logged;
break;
case Pri_VISIBILITY_WORLD: // Public, visible by all the people, even unlogged visitors
ICanSeePhoto = true;
break;
}
ICanSeePhoto = Pri_ShowIsAllowed (UsrDat->PhotoVisibility,UsrDat->UsrCod);
/***** Photo is shown if I can see it, and it exists *****/
return ICanSeePhoto ? Pho_BuildLinkToPhoto (UsrDat,PhotoURL,true) :

View File

@ -51,8 +51,9 @@ typedef enum
void Pri_PutLinkToChangeMyPrivacy (void);
void Pri_EditMyPrivacy (void);
void Pri_PutFormVisibility (Act_Action_t Action,Pri_Visibility_t CurrentVisibilityInDB);
Pri_Visibility_t Pri_GetVisibilityFromStr (const char *Str);
bool Pri_GetParamVisibility (void);
bool Pri_ShowIsAllowed (Pri_Visibility_t Visibility,long OtherUsrCod);
#endif

View File

@ -3064,9 +3064,6 @@ void Rec_GetUsrExtraDataFromRecordForm (struct UsrData *UsrDat)
if (UnsignedNum <= Usr_SEX_MALE)
UsrDat->Sex = (Usr_Sex_t) UnsignedNum;
/***** Get whether photo is public from form *****/
UsrDat->PhotoVisibility = Pri_GetParamVisibility ();
/***** Get country code *****/
Par_GetParToText ("OthCtyCod",LongStr,1+10);
UsrDat->CtyCod = Str_ConvertStrCodToLongCod (LongStr);

View File

@ -27049,6 +27049,27 @@ const char *Txt_Public_open_educational_resource_OER_for_everyone =
"P&uacute;blico, recurso educacional aberto (OER) para todos";
#endif
const char *Txt_Public_profile =
#if L==0
"Perfil p&uacute;blic";
#elif L==1
"&Ouml;ffentliches Benutzer-Profile";
#elif L==2
"Public profile";
#elif L==3
"Perfil p&uacute;blico";
#elif L==4
"Profil public";
#elif L==5
"Perfil p&uacute;blico"; // Okoteve traducción
#elif L==6
"Profilo pubblico";
#elif L==7
"Profil publiczny";
#elif L==8
"Perfil p&uacute;blico";
#endif
const char *Txt_Public_views =
#if L==0
"Accessos p&uacute;blics";
@ -42726,6 +42747,27 @@ const char *Txt_The_visibility_of_your_photo_has_changed =
"The visibility of your photo has changed."; // Necessita de tradução
#endif
const char *Txt_The_visibility_of_your_public_profile_has_changed =
#if L==0
"La visibilidad de su perfil p&uacute;blico ha cambiado."; // Necessita traduccio
#elif L==1
"The visibility of your public profile has changed."; // Need Übersetzung
#elif L==2
"The visibility of your public profile has changed.";
#elif L==3
"La visibilidad de su perfil p&uacute;blico ha cambiado.";
#elif L==4
"The visibility of your public profile has changed."; // Besoin de traduction
#elif L==5
"La visibilidad de su perfil p&uacute;blico ha cambiado."; // Okoteve traducción
#elif L==6
"The visibility of your public profile has changed."; // Bisogno di traduzione
#elif L==7
"The visibility of your public profile has changed."; // Potrzebujesz tlumaczenie
#elif L==8
"The visibility of your public profile has changed."; // Necessita de tradução
#endif
const char *Txt_The_whole_course =
#if L==0
"Toda la asignatura"; // Necessita traduccio

View File

@ -238,7 +238,8 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
UsrDat->EmailConfirmed = false;
UsrDat->Photo[0] = '\0';
UsrDat->PhotoVisibility = Pri_VISIBILITY_DEFAULT;
UsrDat->PhotoVisibility =
UsrDat->ProfileVisibility = Pri_VISIBILITY_DEFAULT;
UsrDat->CtyCod = -1L;
UsrDat->OriginPlace[0] = '\0';
@ -388,7 +389,7 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
/***** Get user's data from database *****/
sprintf (Query,"SELECT EncryptedUsrCod,Password,Surname1,Surname2,FirstName,Sex,"
"Layout,Theme,IconSet,Language,Photo,PhotoVisibility,"
"Layout,Theme,IconSet,Language,Photo,PhotoVisibility,ProfileVisibility,"
"CtyCod,InsCtyCod,InsCod,DptCod,CtrCod,Office,OfficePhone,"
"LocalAddress,LocalPhone,FamilyAddress,FamilyPhone,OriginPlace,Birthday,Comments,"
"Menu,SideCols,NotifNtfEvents,EmailNtfEvents"
@ -468,36 +469,37 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
/* Get rest of data */
strncpy (UsrDat->Photo,row[10],sizeof (UsrDat->Photo)-1);
UsrDat->PhotoVisibility = Pri_GetVisibilityFromStr (row[11]);
UsrDat->CtyCod = Str_ConvertStrCodToLongCod (row[12]);
UsrDat->InsCtyCod = Str_ConvertStrCodToLongCod (row[13]);
UsrDat->InsCod = Str_ConvertStrCodToLongCod (row[14]);
UsrDat->PhotoVisibility = Pri_GetVisibilityFromStr (row[11]);
UsrDat->ProfileVisibility = Pri_GetVisibilityFromStr (row[12]);
UsrDat->CtyCod = Str_ConvertStrCodToLongCod (row[13]);
UsrDat->InsCtyCod = Str_ConvertStrCodToLongCod (row[14]);
UsrDat->InsCod = Str_ConvertStrCodToLongCod (row[15]);
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);
UsrDat->Tch.DptCod = Str_ConvertStrCodToLongCod (row[16]);
UsrDat->Tch.CtrCod = Str_ConvertStrCodToLongCod (row[17]);
strncpy (UsrDat->Tch.Office ,row[18],sizeof (UsrDat->Tch.Office )-1);
strncpy (UsrDat->Tch.OfficePhone,row[19],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[20],sizeof (UsrDat->LocalAddress )-1);
strncpy (UsrDat->LocalPhone ,row[21],sizeof (UsrDat->LocalPhone )-1);
strncpy (UsrDat->FamilyAddress ,row[22],sizeof (UsrDat->FamilyAddress )-1);
strncpy (UsrDat->FamilyPhone ,row[23],sizeof (UsrDat->FamilyPhone )-1);
strncpy (UsrDat->OriginPlace ,row[24],sizeof (UsrDat->OriginPlace )-1);
strcpy (StrBirthday,
row[24] ? row[24] :
row[25] ? row[25] :
"0000-00-00");
Usr_GetUsrCommentsFromString (row[25] ? row[25] :
Usr_GetUsrCommentsFromString (row[26] ? row[26] :
"",
UsrDat); // Get the comments comunes a todas the courses
/* Get menu */
UsrDat->Prefs.Menu = Mnu_MENU_DEFAULT;
if (sscanf (row[26],"%u",&UnsignedNum) == 1)
if (sscanf (row[27],"%u",&UnsignedNum) == 1)
if (UnsignedNum < Mnu_NUM_MENUS)
UsrDat->Prefs.Menu = (Mnu_Menu_t) UnsignedNum;
/* Get if user wants to show side columns */
if (sscanf (row[27],"%u",&UsrDat->Prefs.SideCols) == 1)
if (sscanf (row[28],"%u",&UsrDat->Prefs.SideCols) == 1)
{
if (UsrDat->Prefs.SideCols > Lay_SHOW_BOTH_COLUMNS)
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
@ -506,10 +508,10 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
UsrDat->Prefs.SideCols = Cfg_DEFAULT_COLUMNS;
/* Get on which events I want to be notified by e-mail */
if (sscanf (row[28],"%u",&UsrDat->Prefs.NotifNtfEvents) != 1)
if (sscanf (row[29],"%u",&UsrDat->Prefs.NotifNtfEvents) != 1)
UsrDat->Prefs.NotifNtfEvents = (unsigned) -1; // 0xFF..FF
if (sscanf (row[29],"%u",&UsrDat->Prefs.EmailNtfEvents) != 1)
if (sscanf (row[30],"%u",&UsrDat->Prefs.EmailNtfEvents) != 1)
UsrDat->Prefs.EmailNtfEvents = 0;
if (UsrDat->Prefs.EmailNtfEvents >= (1 << Ntf_NUM_NOTIFY_EVENTS)) // Maximum binary value for NotifyEvents is 000...0011...11
UsrDat->Prefs.EmailNtfEvents = 0;
@ -7428,3 +7430,30 @@ void Usr_ShowUserProfile (void)
Usr_RequestUserProfile ();
}
}
/*****************************************************************************/
/******************** Change my public profile visibility ********************/
/*****************************************************************************/
void Usr_ChangeProfileVisibility (void)
{
extern const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY];
extern const char *Txt_The_visibility_of_your_public_profile_has_changed;
char Query[128];
/***** Get param with public/private photo *****/
Gbl.Usrs.Me.UsrDat.ProfileVisibility = Pri_GetParamVisibility ();
/***** Store public/private photo in database *****/
sprintf (Query,"UPDATE usr_data SET ProfileVisibility='%s'"
" WHERE UsrCod='%ld'",
Pri_VisibilityDB[Gbl.Usrs.Me.UsrDat.ProfileVisibility],
Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryUPDATE (Query,"can not update your preference about public profile visibility");
/***** Show alert *****/
Lay_ShowAlert (Lay_SUCCESS,Txt_The_visibility_of_your_public_profile_has_changed);
/***** Show form again *****/
Pri_EditMyPrivacy ();
}

View File

@ -128,6 +128,7 @@ struct UsrData
bool EmailConfirmed;
char Photo [Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64+1]; // Name of public link to photo
Pri_Visibility_t PhotoVisibility; // Who can see user's photo
Pri_Visibility_t ProfileVisibility; // Who can see user's public profile
long CtyCod; // Country
char OriginPlace [Cns_MAX_BYTES_STRING+1];
struct Date Birthday;
@ -325,5 +326,6 @@ void Usr_GetAndShowNumUsrsInPlatform (Rol_Role_t Role);
void Usr_RequestUserProfile (void);
void Usr_ShowUserProfile (void);
void Usr_ChangeProfileVisibility (void);
#endif