Version 16.92.2

This commit is contained in:
Antonio Cañas Vargas 2016-12-09 14:50:21 +01:00
parent 0d1acb6204
commit d2353760cd
4 changed files with 44 additions and 10 deletions

View File

@ -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 **********************/
/*****************************************************************************/

View File

@ -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)

View File

@ -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,

View File

@ -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;
}