diff --git a/sql/swad.sql b/sql/swad.sql index 8e8ed16a9..2145da761 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -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, diff --git a/swad_action.c b/swad_action.c index 0e6e2bc9e..7bfe4932a 100644 --- a/swad_action.c +++ b/swad_action.c @@ -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: diff --git a/swad_changelog.h b/swad_changelog.h index 5b3b37d3d..5922b9834 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -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: diff --git a/swad_database.c b/swad_database.c index 04c0077a9..49b866e98 100644 --- a/swad_database.c +++ b/swad_database.c @@ -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," diff --git a/swad_photo.c b/swad_photo.c index ecb821a99..7f1bc2db5 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -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'" diff --git a/swad_privacy.c b/swad_privacy.c index 80c11822c..a8d11221c 100644 --- a/swad_privacy.c +++ b/swad_privacy.c @@ -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,"