From d2353760cd2b7b4703e7917ce7126d878ca7850f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Fri, 9 Dec 2016 14:50:21 +0100 Subject: [PATCH] Version 16.92.2 --- swad_agenda.c | 39 ++++++++++++++++++++++++++++++++++++--- swad_changelog.h | 3 ++- swad_record.c | 2 +- swad_user.c | 10 +++++----- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/swad_agenda.c b/swad_agenda.c index 13446683c..06d3062b3 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -38,6 +38,7 @@ #include "swad_pagination.h" #include "swad_parameter.h" #include "swad_photo.h" +#include "swad_privacy.h" #include "swad_QR.h" #include "swad_string.h" @@ -84,6 +85,7 @@ static void Agd_PutIconToViewMyPublicAgenda (void); static void Agd_PutIconToCreateNewEvent (void); static void Agd_PutIconToViewEditMyFullAgenda (void); static void Agd_PutIconToShowQR (void); +static void Agd_PutIconsOtherPublicAgenda (void); static void Agd_PutButtonToCreateNewEvent (void); static void Agd_PutParamsToCreateNewEvent (void); @@ -187,8 +189,8 @@ void Agd_ShowUsrAgenda (void) sprintf (Gbl.Title,Txt_Public_agenda_USER,Gbl.Usrs.Other.UsrDat.FullName); ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); Lay_StartRoundFrame ("100%",Gbl.Title, - ItsMe ? Agd_PutIconToViewEditMyFullAgenda : - NULL, + ItsMe ? Agd_PutIconsMyPublicAgenda : + Agd_PutIconsOtherPublicAgenda, Hlp_PROFILE_Agenda_public_agenda); /***** Show the current events in the user's agenda *****/ @@ -231,7 +233,7 @@ void Agd_ShowOtherAgendaAfterLogIn (void) ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); Lay_StartRoundFrame ("100%",Gbl.Title, ItsMe ? Agd_PutIconToViewEditMyFullAgenda : - NULL, + Agd_PutIconsOtherPublicAgenda, Hlp_PROFILE_Agenda_public_agenda); /***** Show the current events in the user's agenda *****/ @@ -513,6 +515,37 @@ static void Agd_PutIconToShowQR (void) QR_PutLinkToPrintQRCode (ActPrnAgdQR,false); } +static void Agd_PutIconsOtherPublicAgenda (void) + { + extern const char *Txt_View_public_profile; + extern const char *Txt_View_record_for_this_course; + extern const char *Txt_View_record_and_office_hours; + + /***** Button to view user's public profile *****/ + if (Pri_ShowIsAllowed (Gbl.Usrs.Other.UsrDat.ProfileVisibility, + &Gbl.Usrs.Other.UsrDat)) + Lay_PutContextualLink (ActSeePubPrf, + Usr_PutParamOtherUsrCodEncrypted, + "usr64x64.gif", + Txt_View_public_profile,NULL, + NULL); + + /***** Button to view user's record card *****/ + if (Usr_CheckIfICanViewRecordStd (&Gbl.Usrs.Other.UsrDat)) + /* View student's records: common record card and course record card */ + Lay_PutContextualLink (ActSeeRecOneStd, + Usr_PutParamOtherUsrCodEncrypted, + "card64x64.gif", + Txt_View_record_for_this_course,NULL, + NULL); + else if (Usr_CheckIfICanViewRecordTch (&Gbl.Usrs.Other.UsrDat)) + Lay_PutContextualLink (ActSeeRecOneTch, + Usr_PutParamOtherUsrCodEncrypted, + "card64x64.gif", + Txt_View_record_and_office_hours,NULL, + NULL); + } + /*****************************************************************************/ /********************* Put button to create a new event **********************/ /*****************************************************************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 677a0b881..bdb395fec 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -185,13 +185,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.92.1 (2016-12-09)" +#define Log_PLATFORM_VERSION "SWAD 16.92.2 (2016-12-09)" #define CSS_FILE "swad16.86.5.css" #define JS_FILE "swad16.90.2.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 16.92.2: Dec 09, 2016 New icons to view user's profile ant to view user's record card in public agenda. (210308 lines) Version 16.92.1: Dec 09, 2016 New icon to view user's profile in user's record card. (210277 lines) Version 16.92: Dec 09, 2016 Teachers' record cards can be viewed by users sharing courses with them even if no course is selected. Code refactoring in user's record card. (210269 lines) diff --git a/swad_record.c b/swad_record.c index a30328d35..a4f5312b9 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2337,7 +2337,7 @@ static void Rec_PutIconsCommands (void) Txt_Edit_my_personal_data,NULL, NULL); - /***** Button to view user's profile *****/ + /***** Button to view user's public profile *****/ if (ICanViewUsrProfile) Lay_PutContextualLink (ActSeePubPrf, Rec_PutParamUsrCodEncrypted, diff --git a/swad_user.c b/swad_user.c index 50d42dbcd..c6f99c868 100644 --- a/swad_user.c +++ b/swad_user.c @@ -971,7 +971,7 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (const struct UsrData *UsrDat) bool HeBelongsToCurrentCrs; static struct { - long UsrCodChecked; + long UsrCod; bool UsrSharesAnyOfMyCrs; } Cached = { @@ -993,8 +993,8 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (const struct UsrData *UsrDat) return true; /***** 4. Fast check: Does he/she belong to any course? *****/ - if (!(UsrDat->Roles & (1 << Rol_STUDENT || - 1 << Rol_TEACHER))) + if (!(UsrDat->Roles & ((1 << Rol_STUDENT) | // Any of his/her roles is student + (1 << Rol_TEACHER)))) // or teacher? return false; /***** 5. Fast check: Is course selected and we both belong to it? *****/ @@ -1006,7 +1006,7 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (const struct UsrData *UsrDat) return true; /***** 6. Fast check: Is already calculated if user shares any course with me? *****/ - if (UsrDat->UsrCod == Cached.UsrCodChecked) + if (UsrDat->UsrCod == Cached.UsrCod) return Cached.UsrSharesAnyOfMyCrs; /***** 7. Slow check: Get if user shares any course with me from database *****/ @@ -1015,7 +1015,7 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrs (const struct UsrData *UsrDat) " AND CrsCod IN (SELECT CrsCod FROM my_courses_tmp)", UsrDat->UsrCod); Cached.UsrSharesAnyOfMyCrs = DB_QueryCOUNT (Query,"can not check if a user shares any course with you") != 0; - Cached.UsrCodChecked = UsrDat->UsrCod; + Cached.UsrCod = UsrDat->UsrCod; return Cached.UsrSharesAnyOfMyCrs; }