From 51f95f5b419baa93696536f444d394874cb4e92e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 19 Sep 2017 15:06:19 +0200 Subject: [PATCH] Version 17.3.7 --- swad_changelog.h | 3 +- swad_project.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++- swad_text.c | 21 ++++++++ 3 files changed, 153 insertions(+), 2 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 74a63b4ca..21f1a6e4e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -252,13 +252,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 17.3.6 (2017-09-19)" +#define Log_PLATFORM_VERSION "SWAD 17.3.7 (2017-09-19)" #define CSS_FILE "swad17.0.css" #define JS_FILE "swad16.206.3.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 17.3.7: Sep 19, 2017 New row in listing of projects for tutors. Not finished. (229983 lines) Version 17.3.6: Sep 19, 2017 Changes in listing of projects. (229849 lines) Version 17.3.5: Sep 19, 2017 Removed groups in projects. (229858 lines) Version 17.3.4: Sep 19, 2017 Changes in edition of projects. (230170 lines) diff --git a/swad_project.c b/swad_project.c index 67ce32fd8..283f288ca 100644 --- a/swad_project.c +++ b/swad_project.c @@ -70,6 +70,7 @@ static void Prj_PutIconsListProjects (void); static void Prj_PutIconToCreateNewPrj (void); static void Prj_PutButtonToCreateNewPrj (void); static void Prj_ShowOneProject (struct Project *Prj,bool PrintView); +static void Prj_WriteUsrs (long PrjCod); static void Prj_WritePrjAuthor (struct Project *Prj); static void Prj_GetParamPrjOrder (void); @@ -335,6 +336,7 @@ static void Prj_ShowOneProject (struct Project *Prj,bool PrintView) extern const char *Txt_Description; extern const char *Txt_Required_knowledge; extern const char *Txt_Required_materials; + extern const char *Txt_Tutors; static unsigned UniqueId = 0; /***** Get data of this project *****/ @@ -343,7 +345,7 @@ static void Prj_ShowOneProject (struct Project *Prj,bool PrintView) /***** Write first row of data of this project *****/ /* Forms to remove/edit this project */ fprintf (Gbl.F.Out,"" - ""); else @@ -512,9 +514,136 @@ static void Prj_ShowOneProject (struct Project *Prj,bool PrintView) "DAT", Prj->Materials); + /* Project tutors */ + fprintf (Gbl.F.Out,"" + "" + "%s:" + "" + "Hidden ? "ASG_LABEL_LIGHT" : + "ASG_LABEL", + Txt_Tutors); + if (!PrintView) + fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd); + fprintf (Gbl.F.Out," %s\">", + Prj->Hidden ? "DAT_LIGHT" : + "DAT"); + Prj_WriteUsrs (Prj->PrjCod); + fprintf (Gbl.F.Out,"" + ""); + Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; } +/*****************************************************************************/ +/******************** Write list of recipients of a message ******************/ +/*****************************************************************************/ + +static void Prj_WriteUsrs (long PrjCod) + { + extern const char *Txt_ROLES_SINGUL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; + extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; + char Query[2048]; + MYSQL_RES *mysql_res; + MYSQL_ROW row; + unsigned NumUsr; + unsigned NumUsrs; + unsigned NumUsrsKnown; + unsigned NumUsrsUnknown; + unsigned NumUsrsToShow; + struct UsrData UsrDat; + bool UsrValid; + bool ShowPhoto; + char PhotoURL[PATH_MAX + 1]; + + /***** Get number of users of a project from database *****/ + sprintf (Query,"SELECT COUNT(*) FROM prj_usr WHERE PrjCod=%ld", + PrjCod); + NumUsrs = (unsigned) DB_QueryCOUNT (Query,"can not get number of recipients"); + + /***** Get users of a project from database *****/ + sprintf (Query,"SELECT prj_usr.UsrCod," + "usr_data.Surname1 AS S1," + "usr_data.Surname2 AS S2," + "usr_data.FirstName AS FN" + " FROM prj_usr,usr_data" + " WHERE prj_usr.PrjCod=%ld" + " AND prj_usr.UsrCod=usr_data.UsrCod" + " ORDER BY S1,S2,FN", + PrjCod); + NumUsrsKnown = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get users of a project"); + + /***** Check number of users *****/ + if (NumUsrs) + { + /***** Start table *****/ + fprintf (Gbl.F.Out,""); + + /***** How many users will be shown? *****/ + NumUsrsToShow = NumUsrsKnown; + + /***** Initialize structure with user's data *****/ + Usr_UsrDataConstructor (&UsrDat); + + /***** Write known users *****/ + for (NumUsr = 0; + NumUsr < NumUsrsToShow; + NumUsr++) + { + /* Get user's code */ + row = mysql_fetch_row (mysql_res); + UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); + + /* Get user's data */ + UsrValid = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); + + /* Put user's photo */ + fprintf (Gbl.F.Out,"" + "" + ""); + } + + /***** If any users are unknown *****/ + if ((NumUsrsUnknown = NumUsrs - NumUsrsKnown)) + /***** Start form to show all the users *****/ + fprintf (Gbl.F.Out,"" + "" + "", + NumUsrsUnknown, + (NumUsrsUnknown == 1) ? + Txt_ROLES_SINGUL_abc[Rol_UNK][Usr_SEX_UNKNOWN] : + Txt_ROLES_PLURAL_abc[Rol_UNK][Usr_SEX_UNKNOWN]); + + /***** Free memory used for user's data *****/ + Usr_UsrDataDestructor (&UsrDat); + + /***** End table *****/ + fprintf (Gbl.F.Out,"
"); + ShowPhoto = (UsrValid ? Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL) : + false); + Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : + NULL, + "PHOTO21x28",Pho_ZOOM,false); + + /* Write user's name */ + fprintf (Gbl.F.Out,""); + if (UsrValid) + fprintf (Gbl.F.Out,"%s",UsrDat.FullName); + else + fprintf (Gbl.F.Out,"[%s]", + Txt_ROLES_SINGUL_abc[Rol_UNK][Usr_SEX_UNKNOWN]); // User not found, likely a user who has been removed + fprintf (Gbl.F.Out,"
" + "[%u %s]" + "
"); + } + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + /*****************************************************************************/ /*********************** Write the author of a project ***********************/ /*****************************************************************************/ diff --git a/swad_text.c b/swad_text.c index acff7f513..7fd479171 100644 --- a/swad_text.c +++ b/swad_text.c @@ -50216,6 +50216,27 @@ const char *Txt_TF_QST[2] = #endif }; +const char *Txt_Tutors = +#if L==1 + "Tutors"; +#elif L==2 + "Tutoren"; +#elif L==3 + "Tutors"; +#elif L==4 + "Tutores"; +#elif L==5 + "Tuteurs"; +#elif L==6 + "Tutores"; // Okoteve traducción +#elif L==7 + "Tutori"; +#elif L==8 + "Opiekunowie"; +#elif L==9 + "Tutores"; +#endif + const char *Txt_Type = #if L==1 "Tipus";