Version 15.118

This commit is contained in:
Antonio Cañas Vargas 2016-01-18 10:21:18 +01:00
parent 578de4c3cc
commit 4e897e6d1c
10 changed files with 151 additions and 84 deletions

View File

@ -1174,8 +1174,8 @@ CREATE TABLE IF NOT EXISTS usr_data (
Language CHAR(2) NOT NULL,
FirstDayOfWeek TINYINT NOT NULL DEFAULT 0,
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',
PhotoVisibility ENUM('unknown','user','course','system','world') NOT NULL DEFAULT 'unknown',
ProfileVisibility ENUM('unknown','user','course','system','world') NOT NULL DEFAULT 'unknown',
CtyCod INT NOT NULL DEFAULT -1,
InsCtyCod INT NOT NULL DEFAULT -1,
InsCod INT NOT NULL DEFAULT -1,

View File

@ -4599,7 +4599,8 @@ void Act_AdjustCurrentAction (void)
switch (Gbl.Action.Act)
{
case ActHom: case ActLogOut:
case ActFrmUsrAcc: case ActFrmChgMyPwd: case ActReqEdiRecCom:
case ActFrmUsrAcc: case ActFrmChgMyPwd:
case ActReqEdiRecCom:
break;
default:
Gbl.Action.Act = ActReqEdiMyIns;
@ -4607,6 +4608,21 @@ void Act_AdjustCurrentAction (void)
return;
}
/***** If any of my preferences about privacy is unknown *****/
if (Gbl.Usrs.Me.UsrDat.PhotoVisibility == Pri_VISIBILITY_UNKNOWN ||
Gbl.Usrs.Me.UsrDat.ProfileVisibility == Pri_VISIBILITY_UNKNOWN)
switch (Gbl.Action.Act)
{
case ActHom: case ActLogOut:
case ActFrmUsrAcc: case ActFrmChgMyPwd:
case ActReqEdiRecCom: case ActReqEdiMyIns:
break;
default:
Gbl.Action.Act = ActEdiPri;
Tab_SetCurrentTab ();
return;
}
/***** If I belong to current course *****/
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
{
@ -4634,14 +4650,12 @@ void Act_AdjustCurrentAction (void)
case ActFrmChgMyPwd:
case ActReqEdiRecCom:
case ActReqEdiMyIns:
case ActEdiPri:
case ActReqSelGrp:
case ActReqMdfOneStd: // A student use this action to remove him/herself from current course
case ActSeeCrsTT:
case ActPrnCrsTT:
case ActChgCrsTT1stDay:
// case ActSeeMyTT: // TODO: Remove these 3 actions from here?
// case ActPrnMyTT:
// case ActChgMyTT1stDay:
// These last actions are allowed in order to students could see/print timetable before register in groups
break;
default:

View File

@ -122,13 +122,19 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.117.1 (2016-01-18)"
#define Log_PLATFORM_VERSION "SWAD 15.118 (2016-01-18)"
#define CSS_FILE "swad15.117.css"
#define JS_FILE "swad15.117.js"
// 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 sql/swad*.sql | tail -1
/*
Version 15.118: Jan 18, 2016 Change in privacy options (new value "unknown"). (192967 lines)
3 changes necessary in database:
ALTER TABLE usr_data CHANGE COLUMN PhotoVisibility PhotoVisibility ENUM('unknown','user','course','system','world') NOT NULL DEFAULT 'unknown';
ALTER TABLE usr_data CHANGE COLUMN ProfileVisibility ProfileVisibility ENUM('unknown','user','course','system','world') NOT NULL DEFAULT 'unknown';
UPDATE usr_data SET ProfileVisibility='unknown' WHERE ProfileVisibility IN ('user','course');
Version 15.117.1: Jan 18, 2016 Summary of changes in database made from version 15.74.7 to 15.117.1. (? lines)
Edit file swad_copy.sh changing swad.js to swad*.js
29 changes necessary in database:

View File

@ -2466,42 +2466,42 @@ mysql> DESCRIBE usr_banned;
/***** 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 | |
| Theme | char(16) | NO | MUL | NULL | |
| IconSet | char(16) | NO | MUL | NULL | |
| Language | char(2) | NO | MUL | NULL | |
| FirstDayOfWeek | tinyint(4) | NO | MUL | 0 | |
| 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 | |
+-------------------+----------------------------------------+------+-----+---------+----------------+
+-------------------+--------------------------------------------------+------+-----+---------+----------------+
| 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 | |
| Theme | char(16) | NO | MUL | NULL | |
| IconSet | char(16) | NO | MUL | NULL | |
| Language | char(2) | NO | MUL | NULL | |
| FirstDayOfWeek | tinyint(4) | NO | MUL | 0 | |
| Photo | char(43) | NO | | NULL | |
| PhotoVisibility | enum('unknown','user','course','system','world') | NO | | unknown | |
| ProfileVisibility | enum('unknown','user','course','system','world') | NO | | unknown | |
| 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 ("
@ -2517,8 +2517,8 @@ mysql> DESCRIBE usr_data;
"Language CHAR(2) NOT NULL,"
"FirstDayOfWeek TINYINT NOT NULL DEFAULT 0,"
"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',"
"PhotoVisibility ENUM('unknown','user','course','system','world') NOT NULL DEFAULT 'unknown',"
"ProfileVisibility ENUM('unknown','user','course','system','world') NOT NULL DEFAULT 'unknown',"
"CtyCod INT NOT NULL DEFAULT -1,"
"InsCtyCod INT NOT NULL DEFAULT -1,"
"InsCod INT NOT NULL DEFAULT -1,"

View File

@ -1120,7 +1120,7 @@ void Pho_ChangePhotoVisibility (void)
char Query[128];
/***** Get param with public/private photo *****/
Gbl.Usrs.Me.UsrDat.PhotoVisibility = Pri_GetParamVisibility ("VisPho",Pri_PHOTO_VISIBILITY_DEFAULT);
Gbl.Usrs.Me.UsrDat.PhotoVisibility = Pri_GetParamVisibility ("VisPho");
/***** Store public/private photo in database *****/
sprintf (Query,"UPDATE usr_data SET PhotoVisibility='%s'"

View File

@ -46,6 +46,7 @@ extern struct Globals Gbl;
/***** Visibility (who can see user's photo or public profile) *****/
const char *Pri_VisibilityDB[Pri_NUM_OPTIONS_PRIVACY] =
{
"unknown", // Pri_VISIBILITY_UNKNOWN
"user", // Pri_VISIBILITY_USER
"course", // Pri_VISIBILITY_COURSE
"system", // Pri_VISIBILITY_SYSTEM
@ -84,11 +85,17 @@ void Pri_PutLinkToChangeMyPrivacy (void)
void Pri_EditMyPrivacy (void)
{
extern const char *Txt_Please_review_your_privacy_preferences;
extern const char *Txt_Privacy;
extern const char *Txt_Photo;
extern const char *Txt_Public_profile;
extern const char *Txt_Public_activity;
/***** If any of my preferences about privacy is unknown *****/
if (Gbl.Usrs.Me.UsrDat.PhotoVisibility == Pri_VISIBILITY_UNKNOWN ||
Gbl.Usrs.Me.UsrDat.ProfileVisibility == Pri_VISIBILITY_UNKNOWN)
Lay_ShowAlert (Lay_WARNING,Txt_Please_review_your_privacy_preferences);
/***** Start table *****/
Lay_StartRoundFrameTable (NULL,2,Txt_Privacy);
@ -145,8 +152,8 @@ static void Pri_PutFormVisibility (const char *TxtLabel,
if (Action != ActUnk)
Act_FormStart (Action);
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
for (Visibility = (Pri_Visibility_t) 0;
Visibility < Pri_NUM_OPTIONS_PRIVACY;
for (Visibility = Pri_VISIBILITY_USER;
Visibility <= Pri_VISIBILITY_WORLD;
Visibility++)
if (MaskAllowedVisibility & 1 << Visibility)
{
@ -180,8 +187,7 @@ static void Pri_PutFormVisibility (const char *TxtLabel,
/************************ Get visibility from string *************************/
/*****************************************************************************/
Pri_Visibility_t Pri_GetVisibilityFromStr (const char *Str,
Pri_Visibility_t DefaultVisibility)
Pri_Visibility_t Pri_GetVisibilityFromStr (const char *Str)
{
Pri_Visibility_t Visibility;
@ -191,15 +197,14 @@ Pri_Visibility_t Pri_GetVisibilityFromStr (const char *Str,
if (!strcasecmp (Str,Pri_VisibilityDB[Visibility]))
return Visibility;
return DefaultVisibility;
return Pri_VISIBILITY_UNKNOWN;
}
/*****************************************************************************/
/**************** Get parameter with visibility from form ********************/
/*****************************************************************************/
Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName,
Pri_Visibility_t DefaultVisibility)
Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName)
{
char UnsignedStr[10+1];
unsigned UnsignedNum;
@ -214,7 +219,7 @@ Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName,
return (Pri_Visibility_t) UnsignedNum;
}
return DefaultVisibility;
return Pri_VISIBILITY_UNKNOWN;
}
/*****************************************************************************/
@ -231,6 +236,8 @@ bool Pri_ShowIsAllowed (Pri_Visibility_t Visibility,long OtherUsrCod)
/***** Check if I can see the other's photo *****/
switch (Visibility)
{
case Pri_VISIBILITY_UNKNOWN:
return (Gbl.Usrs.Me.UsrDat.UsrCod == OtherUsrCod); // It's me? I always can see my things
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 (Gbl.Usrs.Me.UsrDat.UsrCod == OtherUsrCod) // It's me, I always can see my things
return true;

View File

@ -32,14 +32,15 @@
/*****************************************************************************/
/***** Visibility (who can see user's photo / public profile) *****/
#define Pri_NUM_OPTIONS_PRIVACY 4
#define Pri_NUM_OPTIONS_PRIVACY 5
typedef enum // These numbers are stored in database. So, if you change them here, do the same in database
typedef enum
{
Pri_VISIBILITY_USER = 0, // Only visible by me and my teachers if I am a student or my students if I am a teacher
Pri_VISIBILITY_COURSE = 1, // Visible by users sharing courses with me
Pri_VISIBILITY_SYSTEM = 2, // Visible by any user logged in platform
Pri_VISIBILITY_WORLD = 3, // Public, visible by all the people, even unlogged visitors
Pri_VISIBILITY_UNKNOWN = 0, // Only visible by me and my teachers if I am a student or my students if I am a teacher
Pri_VISIBILITY_USER = 1, // Only visible by me and my teachers if I am a student or my students if I am a teacher
Pri_VISIBILITY_COURSE = 2, // Visible by users sharing courses with me
Pri_VISIBILITY_SYSTEM = 3, // Visible by any user logged in platform
Pri_VISIBILITY_WORLD = 4, // Public, visible by all the people, even unlogged visitors
} Pri_Visibility_t;
#define Pri_PHOTO_VISIBILITY_DEFAULT Pri_VISIBILITY_SYSTEM
@ -52,10 +53,8 @@ typedef enum // These numbers are stored in database. So, if you change them her
void Pri_PutLinkToChangeMyPrivacy (void);
void Pri_EditMyPrivacy (void);
Pri_Visibility_t Pri_GetVisibilityFromStr (const char *Str,
Pri_Visibility_t DefaultVisibility);
Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName,
Pri_Visibility_t DefaultVisibility);
Pri_Visibility_t Pri_GetVisibilityFromStr (const char *Str);
Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName);
bool Pri_ShowIsAllowed (Pri_Visibility_t Visibility,long OtherUsrCod);

View File

@ -284,7 +284,7 @@ void Prf_ChangeProfileVisibility (void)
char Query[128];
/***** Get param with public/private photo *****/
Gbl.Usrs.Me.UsrDat.ProfileVisibility = Pri_GetParamVisibility ("VisPrf",Pri_PROFILE_VISIBILITY_DEFAULT);
Gbl.Usrs.Me.UsrDat.ProfileVisibility = Pri_GetParamVisibility ("VisPrf");
/***** Store public/private photo in database *****/
sprintf (Query,"UPDATE usr_data SET ProfileVisibility='%s'"

View File

@ -27293,6 +27293,27 @@ const char *Txt_Please_fill_in_your_record_card_including_your_sex =
" incluindo o seu sexo.";
#endif
const char *Txt_Please_review_your_privacy_preferences =
#if L==1
"Si us plau, revisi les seves prefer&egrave;ncies de privacitat.";
#elif L==2
"Bitte &uuml;berpr&uuml;fen Sie Ihre Datenschutzeinstellungen.";
#elif L==3
"Please review your privacy preferences.";
#elif L==4
"Por favor, revise sus preferencias de privacidad.";
#elif L==5
"S'il vous pla&icirc;t revoir vos pr&eacute;f&eacute;rences de privacit&eacute;.";
#elif L==6
"Por favor, revise sus preferencias de privacidad."; // Okoteve traducción
#elif L==7
"Si prega di rivedere le vostre preferenze di privatezza.";
#elif L==8
"Prosz&eogon; sprawdzi&cacute; ustawienia prywatno&sacute;ci.";
#elif L==9
"Por favor, revise suas prefer&ecirc;ncias de privacidade.";
#endif
const char *Txt_Please_specify_if_you_allow_access_to_test_questions_from_mobile_applications =
#if L==1
"Por favor, especifique si permite el acceso"
@ -27681,7 +27702,27 @@ const char *Txt_Privacy =
#endif
const char *Txt_PRIVACY_OPTIONS[Pri_NUM_OPTIONS_PRIVACY] =
{ // Pri_VISIBILITY_USER
{ // Pri_VISIBILITY_UNKNOWN
#if L==1
"Desconeguda"
#elif L==2
"Unbekannt"
#elif L==3
"Unknown"
#elif L==4
"Desconocida"
#elif L==5
"Inconnu"
#elif L==6
"Desconocida" // Okoteve traducción
#elif L==7
"Sconosciuta"
#elif L==8
"Nieznany"
#elif L==9
"Desconhecida"
#endif
, // Pri_VISIBILITY_USER
#if L==1
"Visible por m&iacute; y mis profesores / mis estudiantes" // Necessita traduccio
#elif L==2

View File

@ -240,10 +240,10 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
UsrDat->Accepted = true;
UsrDat->Sex = Usr_SEX_UNKNOWN;
UsrDat->Surname1[0] = '\0';
UsrDat->Surname2[0] = '\0';
UsrDat->Surname1[0] = '\0';
UsrDat->Surname2[0] = '\0';
UsrDat->FirstName[0] = '\0';
UsrDat->FullName[0] = '\0';
UsrDat->FullName[0] = '\0';
UsrDat->Email[0] = '\0';
UsrDat->EmailConfirmed = false;
@ -255,29 +255,29 @@ void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat)
UsrDat->CtyCod = -1L;
UsrDat->OriginPlace[0] = '\0';
UsrDat->StrBirthday[0] = '\0';
UsrDat->Birthday.Day = 0;
UsrDat->Birthday.Day = 0;
UsrDat->Birthday.Month = 0;
UsrDat->Birthday.Year = 0;
UsrDat->LocalAddress[0] = '\0';
UsrDat->LocalPhone[0] = '\0';
UsrDat->Birthday.Year = 0;
UsrDat->LocalAddress[0] = '\0';
UsrDat->LocalPhone[0] = '\0';
UsrDat->FamilyAddress[0] = '\0';
UsrDat->FamilyPhone[0] = '\0';
UsrDat->FamilyPhone[0] = '\0';
if (UsrDat->Comments)
UsrDat->Comments[0] = '\0';
UsrDat->InsCtyCod = -1L;
UsrDat->InsCod = -1L;
UsrDat->InsCtyCod = -1L;
UsrDat->InsCod = -1L;
UsrDat->Tch.CtrCod = -1L;
UsrDat->Tch.DptCod = -1L;
UsrDat->Tch.Office[0] = '\0';
UsrDat->Tch.Office[0] = '\0';
UsrDat->Tch.OfficePhone[0] = '\0';
UsrDat->Prefs.Language = Txt_LANGUAGE_UNKNOWN; // Language unknown
UsrDat->Prefs.Language = Txt_LANGUAGE_UNKNOWN; // Language unknown
UsrDat->Prefs.FirstDayOfWeek = Cal_FIRST_DAY_OF_WEEK_DEFAULT; // Default first day of week
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.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.EmailNtfEvents = 0; // By default, don't notify anything
}
@ -486,8 +486,8 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
/* Get rest of data */
strncpy (UsrDat->Photo,row[10],sizeof (UsrDat->Photo) - 1);
UsrDat->Photo[sizeof (UsrDat->Photo) - 1] = '\0';
UsrDat->PhotoVisibility = Pri_GetVisibilityFromStr (row[11],Pri_PHOTO_VISIBILITY_DEFAULT);
UsrDat->ProfileVisibility = Pri_GetVisibilityFromStr (row[12],Pri_PROFILE_VISIBILITY_DEFAULT);
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]);