From 52ebde0ba2a546032bd50fcce6954c041bc48429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 25 Jul 2016 16:08:25 +0200 Subject: [PATCH] Version 15.244 --- swad_changelog.h | 6 ++--- swad_user.c | 60 +++++++++++++++++++++++++++--------------------- swad_user.h | 2 +- 3 files changed, 38 insertions(+), 30 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 1875cacb..1a33de5e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -131,21 +131,21 @@ // TODO: In list of users, institution should be the institution photo with internal link to institution // TODO: IMPORTANT FOR SWADROID: For reasons of speed, when getting list of users (find/get), get all main data in the find/get query, do not iterate with multiple queries -// TODO: Remove "e-mail" column from list of users (usually it's not necessary) // TODO: Upload photos/files from SWADroid using MIME attachments /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.243.2 (2016-07-24)" +#define Log_PLATFORM_VERSION "SWAD 15.244 (2016-07-24)" #define CSS_FILE "swad15.229.css" #define JS_FILE "swad15.238.1.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.243.2: Jul 24, 2016 Guests now have permission to write messages. (? lines) + Version 15.244: Jul 25, 2016 Removed e-mail column from some lists of users (usually it's not necessary). (203969 lines) + Version 15.243.2: Jul 24, 2016 Guests now have permission to write messages. (203963 lines) Version 15.243.1: Jul 21, 2016 Fixed bugs in web service. (203962 lines) Version 15.243: Jul 20, 2016 Fixed bug in web service (getNotifications). Code refactoring in web service. (203956 lines) diff --git a/swad_user.c b/swad_user.c index eecc7261..42e6864d 100644 --- a/swad_user.c +++ b/swad_user.c @@ -84,8 +84,8 @@ const char *Usr_IconsClassPhotoOrList[Usr_NUM_USR_LIST_TYPES] = "list64x64.gif" }; -#define Usr_NUM_MAIN_FIELDS_DATA_ADM 8 -#define Usr_NUM_ALL_FIELDS_DATA_INV 17 +#define Usr_NUM_MAIN_FIELDS_DATA_ADM 7 +#define Usr_NUM_ALL_FIELDS_DATA_GST 17 #define Usr_NUM_ALL_FIELDS_DATA_STD 13 #define Usr_NUM_ALL_FIELDS_DATA_TCH 11 const char *Usr_UsrDatMainFieldNames[Usr_NUM_MAIN_FIELDS_DATA_USR]; @@ -137,6 +137,7 @@ static void Usr_WriteMainUsrDataExceptUsrID (struct UsrData *UsrDat, const char *BgColor, const char *InstitutionName, const char *InstitutionLink); +static void Usr_WriteEmail (struct UsrData *UsrDat,const char *BgColor); static void Usr_WriteUsrData (const char *BgColor, const char *Data,const char *Link, bool NonBreak,bool Accepted); @@ -2887,6 +2888,7 @@ static void Usr_WriteRowGstAllData (struct UsrData *UsrDat) Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA); Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd], Ins.ShortName,NULL); + Usr_WriteEmail (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd]); /***** Write the rest of the data of the guest *****/ if (UsrDat->Tch.CtrCod > 0) @@ -2988,6 +2990,7 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames) Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA); Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd], Ins.ShortName,NULL); + Usr_WriteEmail (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd]); /***** Write the rest of the data of the student *****/ Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd], @@ -3102,6 +3105,7 @@ static void Usr_WriteRowTchAllData (struct UsrData *UsrDat) Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA); Usr_WriteMainUsrDataExceptUsrID (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd], Ins.ShortName,NULL); + Usr_WriteEmail (UsrDat,Gbl.ColorRows[Gbl.RowEvenOdd]); /***** Write the rest of teacher's data *****/ if (ShowData && UsrDat->Tch.CtrCod > 0) @@ -3208,9 +3212,6 @@ static void Usr_WriteMainUsrDataExceptUsrID (struct UsrData *UsrDat, const char *InstitutionName, const char *InstitutionLink) { - bool ShowEmail; - char MailLink[7+Usr_MAX_BYTES_USR_EMAIL+1]; // mailto:mail_address - Usr_WriteUsrData (BgColor, UsrDat->Surname1[0] ? UsrDat->Surname1 : " ", @@ -3223,11 +3224,25 @@ static void Usr_WriteMainUsrDataExceptUsrID (struct UsrData *UsrDat, UsrDat->FirstName[0] ? UsrDat->FirstName : " ", NULL,true,UsrDat->Accepted); + Usr_WriteUsrData (BgColor, + UsrDat->InsCod > 0 ? InstitutionName : + " ", + InstitutionLink,true,UsrDat->Accepted); + } + +/*****************************************************************************/ +/**************************** Write user's e-mail ****************************/ +/*****************************************************************************/ + +static void Usr_WriteEmail (struct UsrData *UsrDat,const char *BgColor) + { + bool ShowEmail; + char MailLink[7+Usr_MAX_BYTES_USR_EMAIL+1]; // mailto:mail_address + if (UsrDat->Email[0]) { ShowEmail = Mai_ICanSeeEmail (UsrDat); sprintf (MailLink,"mailto:%s",UsrDat->Email); - Str_LimitLengthHTMLStr (UsrDat->Email,10); } else ShowEmail = false; @@ -3238,10 +3253,6 @@ static void Usr_WriteMainUsrDataExceptUsrID (struct UsrData *UsrDat, ShowEmail ? MailLink : NULL, true,UsrDat->Accepted); - Usr_WriteUsrData (BgColor, - UsrDat->InsCod > 0 ? InstitutionName : - " ", - InstitutionLink,true,UsrDat->Accepted); } /*****************************************************************************/ @@ -5197,7 +5208,6 @@ void Usr_SetUsrDatMainFieldNames (void) extern const char *Txt_Surname_1; extern const char *Txt_Surname_2; extern const char *Txt_First_name; - extern const char *Txt_Email; extern const char *Txt_Institution; /***** Initialize field names *****/ @@ -5208,8 +5218,7 @@ void Usr_SetUsrDatMainFieldNames (void) Usr_UsrDatMainFieldNames[4] = Txt_Surname_1; Usr_UsrDatMainFieldNames[5] = Txt_Surname_2; Usr_UsrDatMainFieldNames[6] = Txt_First_name; - Usr_UsrDatMainFieldNames[7] = Txt_Email; - Usr_UsrDatMainFieldNames[8] = Txt_Institution; + Usr_UsrDatMainFieldNames[7] = Txt_Institution; } /*****************************************************************************/ @@ -5432,8 +5441,8 @@ void Usr_ListAllDataGsts (void) extern const char *Txt_Surname_1; extern const char *Txt_Surname_2; extern const char *Txt_First_name; - extern const char *Txt_Email; extern const char *Txt_Institution; + extern const char *Txt_Email; extern const char *Txt_Centre; extern const char *Txt_Department; extern const char *Txt_Office; @@ -5446,7 +5455,7 @@ void Usr_ListAllDataGsts (void) unsigned NumCol; unsigned NumUsr; struct UsrData UsrDat; - const char *FieldNames[Usr_NUM_ALL_FIELDS_DATA_INV]; + const char *FieldNames[Usr_NUM_ALL_FIELDS_DATA_GST]; /***** Initialize field names *****/ FieldNames[ 0] = Txt_Photo; @@ -5454,8 +5463,8 @@ void Usr_ListAllDataGsts (void) FieldNames[ 2] = Txt_Surname_1; FieldNames[ 3] = Txt_Surname_2; FieldNames[ 4] = Txt_First_name; - FieldNames[ 5] = Txt_Email; - FieldNames[ 6] = Txt_Institution; + FieldNames[ 5] = Txt_Institution; + FieldNames[ 6] = Txt_Email; FieldNames[ 7] = Txt_Centre; FieldNames[ 8] = Txt_Department; FieldNames[ 9] = Txt_Office; @@ -5482,7 +5491,7 @@ void Usr_ListAllDataGsts (void) if (Gbl.Usrs.LstUsrs[Rol__GUEST_].NumUsrs) { /***** Set number of columns *****/ - NumColumnsCommonCard = Usr_NUM_ALL_FIELDS_DATA_INV; + NumColumnsCommonCard = Usr_NUM_ALL_FIELDS_DATA_GST; /***** Start table with list of guests *****/ /* Start row */ @@ -5546,8 +5555,8 @@ void Usr_ListAllDataStds (void) extern const char *Txt_Surname_1; extern const char *Txt_Surname_2; extern const char *Txt_First_name; - extern const char *Txt_Email; extern const char *Txt_Institution; + extern const char *Txt_Email; extern const char *Txt_Local_address; extern const char *Txt_Phone; extern const char *Txt_Family_address; @@ -5571,8 +5580,8 @@ void Usr_ListAllDataStds (void) FieldNames[ 2] = Txt_Surname_1; FieldNames[ 3] = Txt_Surname_2; FieldNames[ 4] = Txt_First_name; - FieldNames[ 5] = Txt_Email; - FieldNames[ 6] = Txt_Institution; + FieldNames[ 5] = Txt_Institution; + FieldNames[ 6] = Txt_Email; FieldNames[ 7] = Txt_Local_address; FieldNames[ 8] = Txt_Phone; FieldNames[ 9] = Txt_Family_address; @@ -5782,8 +5791,8 @@ void Usr_ListAllDataTchs (void) extern const char *Txt_Surname_1; extern const char *Txt_Surname_2; extern const char *Txt_First_name; - extern const char *Txt_Email; extern const char *Txt_Institution; + extern const char *Txt_Email; extern const char *Txt_Centre; extern const char *Txt_Department; extern const char *Txt_Office; @@ -5801,8 +5810,8 @@ void Usr_ListAllDataTchs (void) FieldNames[ 2] = Txt_Surname_1; FieldNames[ 3] = Txt_Surname_2; FieldNames[ 4] = Txt_First_name; - FieldNames[ 5] = Txt_Email; - FieldNames[ 6] = Txt_Institution; + FieldNames[ 5] = Txt_Institution; + FieldNames[ 6] = Txt_Email; FieldNames[ 7] = Txt_Centre; FieldNames[ 8] = Txt_Department; FieldNames[ 9] = Txt_Office; @@ -6021,8 +6030,7 @@ void Usr_ListDataAdms (void) FieldNames[3] = Txt_Surname_1; FieldNames[4] = Txt_Surname_2; FieldNames[5] = Txt_First_name; - FieldNames[6] = Txt_Email; - FieldNames[7] = Txt_Institution; + FieldNames[6] = Txt_Institution; /***** Get and update type of list, number of columns in class photo diff --git a/swad_user.h b/swad_user.h index b5fa90d3..f837bd8e 100644 --- a/swad_user.h +++ b/swad_user.h @@ -73,7 +73,7 @@ #define Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS (Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64*Cfg_MAX_USRS_IN_LIST) -#define Usr_NUM_MAIN_FIELDS_DATA_USR 9 +#define Usr_NUM_MAIN_FIELDS_DATA_USR 8 /*****************************************************************************/ /******************************** Public types *******************************/