mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-01 06:15:31 +02:00
Version 18.54.1
This commit is contained in:
parent
d0d7ac6209
commit
642324598a
2664
swad_action.c
2664
swad_action.c
File diff suppressed because it is too large
Load Diff
|
@ -278,8 +278,6 @@
|
||||||
|
|
||||||
// TODO: A superuser can not see records of teachers? Why?
|
// TODO: A superuser can not see records of teachers? Why?
|
||||||
|
|
||||||
// TODO: After "Do not show it again" nothing is displayed.
|
|
||||||
|
|
||||||
// TODO: Non-editing teachers should can control assistance of students in their groups
|
// TODO: Non-editing teachers should can control assistance of students in their groups
|
||||||
|
|
||||||
// TODO: Enviar correo a todos los profesores de una asignatura, sugerido por Pedro Villar Castro
|
// TODO: Enviar correo a todos los profesores de una asignatura, sugerido por Pedro Villar Castro
|
||||||
|
@ -410,6 +408,8 @@ Antonio
|
||||||
|
|
||||||
// TODO: Actualizar ayuda en GitHub, por ejemplo Preferencias ahora es Ajustes.
|
// TODO: Actualizar ayuda en GitHub, por ejemplo Preferencias ahora es Ajustes.
|
||||||
|
|
||||||
|
// TODO: Chequear negritas en lista de foros, en color rosa por ej. Habrá que cambiar clases
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -429,11 +429,12 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.54 (2019-02-21)"
|
#define Log_PLATFORM_VERSION "SWAD 18.54.1 (2019-02-21)"
|
||||||
#define CSS_FILE "swad18.54.css"
|
#define CSS_FILE "swad18.54.css"
|
||||||
#define JS_FILE "swad18.51.js"
|
#define JS_FILE "swad18.51.js"
|
||||||
/*
|
/*
|
||||||
Version 18.54: Feb 21, 2019 Selection of users scope in timeline is made with icons. (? lines)
|
Version 18.54.1: Feb 22, 2019 Following and followers shown in photo zoom. (237586 lines)
|
||||||
|
Version 18.54: Feb 21, 2019 Selection of users scope in timeline is made with icons. (237534 lines)
|
||||||
Version 18.53: Feb 21, 2019 Last selection of users scope in timeline is saved in database. (237538 lines)
|
Version 18.53: Feb 21, 2019 Last selection of users scope in timeline is saved in database. (237538 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
ALTER TABLE usr_last ADD COLUMN TimelineUsrs TINYINT NOT NULL DEFAULT 0 AFTER LastAccNotif;
|
ALTER TABLE usr_last ADD COLUMN TimelineUsrs TINYINT NOT NULL DEFAULT 0 AFTER LastAccNotif;
|
||||||
|
|
|
@ -453,24 +453,39 @@ bool Fol_CheckUsrIsFollowerOf (long FollowerCod,long FollowedCod)
|
||||||
/*************************** Get number of followed **************************/
|
/*************************** Get number of followed **************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
unsigned Fol_GetNumFollowing (long UsrCod)
|
void Fol_FlushCacheFollow (void)
|
||||||
{
|
{
|
||||||
/***** Check if a user is a follower of another user *****/
|
Gbl.Cache.Follow.UsrCod = -1L;
|
||||||
return
|
Gbl.Cache.Follow.NumFollowing =
|
||||||
|
Gbl.Cache.Follow.NumFollowers = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Fol_GetNumFollow (long UsrCod,
|
||||||
|
unsigned *NumFollowing,unsigned *NumFollowers)
|
||||||
|
{
|
||||||
|
/***** 1. Fast check: trivial cases *****/
|
||||||
|
if (UsrCod <= 0)
|
||||||
|
{
|
||||||
|
*NumFollowing = *NumFollowers = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** 2. Fast check: Is number of following already calculated? *****/
|
||||||
|
if (UsrCod == Gbl.Cache.Follow.UsrCod)
|
||||||
|
{
|
||||||
|
*NumFollowing = Gbl.Cache.Follow.NumFollowing;
|
||||||
|
*NumFollowers = Gbl.Cache.Follow.NumFollowers;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** 3. Slow check: Get number of following/followers from database *****/
|
||||||
|
Gbl.Cache.Follow.UsrCod = UsrCod;
|
||||||
|
*NumFollowing = Gbl.Cache.Follow.NumFollowing =
|
||||||
(unsigned) DB_QueryCOUNT ("can not get number of followed",
|
(unsigned) DB_QueryCOUNT ("can not get number of followed",
|
||||||
"SELECT COUNT(*) FROM usr_follow"
|
"SELECT COUNT(*) FROM usr_follow"
|
||||||
" WHERE FollowerCod=%ld",
|
" WHERE FollowerCod=%ld",
|
||||||
UsrCod);
|
UsrCod);
|
||||||
}
|
*NumFollowers = Gbl.Cache.Follow.NumFollowers =
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************************** Get number of followers **************************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
unsigned Fol_GetNumFollowers (long UsrCod)
|
|
||||||
{
|
|
||||||
/***** Check if a user is a follower of another user *****/
|
|
||||||
return
|
|
||||||
(unsigned) DB_QueryCOUNT ("can not get number of followers",
|
(unsigned) DB_QueryCOUNT ("can not get number of followers",
|
||||||
"SELECT COUNT(*) FROM usr_follow"
|
"SELECT COUNT(*) FROM usr_follow"
|
||||||
" WHERE FollowedCod=%ld",
|
" WHERE FollowedCod=%ld",
|
||||||
|
@ -1019,6 +1034,9 @@ void Fol_FollowUsr1 (void)
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
|
/***** Flush cache *****/
|
||||||
|
Fol_FlushCacheFollow ();
|
||||||
|
|
||||||
/***** This follow must be notified by email? *****/
|
/***** This follow must be notified by email? *****/
|
||||||
CreateNotif = (Gbl.Usrs.Other.UsrDat.Prefs.NotifNtfEvents & (1 << Ntf_EVENT_FOLLOWER));
|
CreateNotif = (Gbl.Usrs.Other.UsrDat.Prefs.NotifNtfEvents & (1 << Ntf_EVENT_FOLLOWER));
|
||||||
NotifyByEmail = CreateNotif &&
|
NotifyByEmail = CreateNotif &&
|
||||||
|
@ -1072,12 +1090,17 @@ void Fol_UnfollowUsr1 (void)
|
||||||
// Unfollow only if I follow him/her
|
// Unfollow only if I follow him/her
|
||||||
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
if (Fol_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod))
|
Gbl.Usrs.Other.UsrDat.UsrCod))
|
||||||
|
{
|
||||||
/***** Unfollow user in database *****/
|
/***** Unfollow user in database *****/
|
||||||
DB_QueryREPLACE ("can not unfollow user",
|
DB_QueryREPLACE ("can not unfollow user",
|
||||||
"DELETE FROM usr_follow"
|
"DELETE FROM usr_follow"
|
||||||
" WHERE FollowerCod=%ld AND FollowedCod=%ld",
|
" WHERE FollowerCod=%ld AND FollowedCod=%ld",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
|
|
||||||
|
/***** Flush cache *****/
|
||||||
|
Fol_FlushCacheFollow ();
|
||||||
|
}
|
||||||
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
Gbl.DelayedAlert.Type = Ale_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1221,4 +1244,7 @@ void Fol_RemoveUsrFromUsrFollow (long UsrCod)
|
||||||
"DELETE FROM usr_follow"
|
"DELETE FROM usr_follow"
|
||||||
" WHERE FollowerCod=%ld OR FollowedCod=%ld",
|
" WHERE FollowerCod=%ld OR FollowedCod=%ld",
|
||||||
UsrCod,UsrCod);
|
UsrCod,UsrCod);
|
||||||
|
|
||||||
|
/***** Flush cache *****/
|
||||||
|
Fol_FlushCacheFollow ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,9 @@ void Fol_SuggestUsrsToFollowMainZone (void);
|
||||||
void Fol_SuggestUsrsToFollowMainZoneOnRightColumn (void);
|
void Fol_SuggestUsrsToFollowMainZoneOnRightColumn (void);
|
||||||
|
|
||||||
bool Fol_CheckUsrIsFollowerOf (long FollowerCod,long FollowedCod);
|
bool Fol_CheckUsrIsFollowerOf (long FollowerCod,long FollowedCod);
|
||||||
unsigned Fol_GetNumFollowing (long UsrCod);
|
void Fol_FlushCacheFollow (void);
|
||||||
|
void Fol_GetNumFollow (long UsrCod,
|
||||||
|
unsigned *NumFollowing,unsigned *NumFollowers);
|
||||||
unsigned Fol_GetNumFollowers (long UsrCod);
|
unsigned Fol_GetNumFollowers (long UsrCod);
|
||||||
void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat,
|
void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat,
|
||||||
unsigned NumFollowing,unsigned NumFollowers,
|
unsigned NumFollowing,unsigned NumFollowers,
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "swad_config.h"
|
#include "swad_config.h"
|
||||||
#include "swad_constant.h"
|
#include "swad_constant.h"
|
||||||
#include "swad_exam.h"
|
#include "swad_exam.h"
|
||||||
|
#include "swad_follow.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
#include "swad_icon.h"
|
#include "swad_icon.h"
|
||||||
#include "swad_parameter.h"
|
#include "swad_parameter.h"
|
||||||
|
@ -486,6 +487,7 @@ void Gbl_InitializeGlobals (void)
|
||||||
Prj_FlushCacheMyRoleInProject ();
|
Prj_FlushCacheMyRoleInProject ();
|
||||||
Grp_FlushCacheIBelongToGrp ();
|
Grp_FlushCacheIBelongToGrp ();
|
||||||
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
||||||
|
Fol_FlushCacheFollow ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -870,6 +870,12 @@ struct Globals
|
||||||
long PrjCod;
|
long PrjCod;
|
||||||
Prj_RoleInProject_t RoleInProject;
|
Prj_RoleInProject_t RoleInProject;
|
||||||
} MyRoleInProject;
|
} MyRoleInProject;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
long UsrCod;
|
||||||
|
unsigned NumFollowing;
|
||||||
|
unsigned NumFollowers;
|
||||||
|
} Follow;
|
||||||
} Cache;
|
} Cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
16
swad_photo.c
16
swad_photo.c
|
@ -40,6 +40,7 @@
|
||||||
#include "swad_enrolment.h"
|
#include "swad_enrolment.h"
|
||||||
#include "swad_file.h"
|
#include "swad_file.h"
|
||||||
#include "swad_file_browser.h"
|
#include "swad_file_browser.h"
|
||||||
|
#include "swad_follow.h"
|
||||||
#include "swad_form.h"
|
#include "swad_form.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
#include "swad_logo.h"
|
#include "swad_logo.h"
|
||||||
|
@ -1183,6 +1184,10 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
|
||||||
const char *ClassPhoto,Pho_Zoom_t Zoom,
|
const char *ClassPhoto,Pho_Zoom_t Zoom,
|
||||||
bool FormUnique)
|
bool FormUnique)
|
||||||
{
|
{
|
||||||
|
extern const char *Txt_Following;
|
||||||
|
extern const char *Txt_Followers;
|
||||||
|
unsigned NumFollowing;
|
||||||
|
unsigned NumFollowers;
|
||||||
bool PhotoExists;
|
bool PhotoExists;
|
||||||
bool BrowserTabIs1stTab = Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB;
|
bool BrowserTabIs1stTab = Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB;
|
||||||
bool PutLinkToPublicProfile = !Gbl.Form.Inside && // Only if not inside another form
|
bool PutLinkToPublicProfile = !Gbl.Form.Inside && // Only if not inside another form
|
||||||
|
@ -1236,6 +1241,17 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL,
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Following and followers */
|
||||||
|
Fol_GetNumFollow (UsrDat->UsrCod,&NumFollowing,&NumFollowers);
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"ZOOM_TXT_LINE\">"
|
||||||
|
"<span class=\"DAT_N_BOLD\">%u</span>"
|
||||||
|
"<span class=\"DAT_SMALL\"> %s </span>"
|
||||||
|
"<span class=\"DAT_N_BOLD\">%u</span>"
|
||||||
|
"<span class=\"DAT_SMALL\"> %s</span>"
|
||||||
|
"</div>",
|
||||||
|
NumFollowing,Txt_Following,
|
||||||
|
NumFollowers,Txt_Followers);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -301,8 +301,7 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat)
|
||||||
Prf_ShowDetailsUserProfile (UsrDat);
|
Prf_ShowDetailsUserProfile (UsrDat);
|
||||||
|
|
||||||
/***** Count following and followers *****/
|
/***** Count following and followers *****/
|
||||||
NumFollowing = Fol_GetNumFollowing (UsrDat->UsrCod);
|
Fol_GetNumFollow (UsrDat->UsrCod,&NumFollowing,&NumFollowers);
|
||||||
NumFollowers = Fol_GetNumFollowers (UsrDat->UsrCod);
|
|
||||||
UsrFollowsMe = false;
|
UsrFollowsMe = false;
|
||||||
if (NumFollowing)
|
if (NumFollowing)
|
||||||
UsrFollowsMe = Fol_CheckUsrIsFollowerOf (UsrDat->UsrCod,
|
UsrFollowsMe = Fol_CheckUsrIsFollowerOf (UsrDat->UsrCod,
|
||||||
|
|
|
@ -344,7 +344,7 @@ Rol_Role_t Rol_GetRoleUsrInCrs (long UsrCod,long CrsCod)
|
||||||
CrsCod <= 0)
|
CrsCod <= 0)
|
||||||
return Rol_UNK;
|
return Rol_UNK;
|
||||||
|
|
||||||
/***** 2. Fast check: Is role in course already calculated *****/
|
/***** 2. Fast check: Is role in course already calculated? *****/
|
||||||
if (UsrCod == Gbl.Cache.RoleUsrInCrs.UsrCod &&
|
if (UsrCod == Gbl.Cache.RoleUsrInCrs.UsrCod &&
|
||||||
CrsCod == Gbl.Cache.RoleUsrInCrs.CrsCod )
|
CrsCod == Gbl.Cache.RoleUsrInCrs.CrsCod )
|
||||||
return Gbl.Cache.RoleUsrInCrs.Role;
|
return Gbl.Cache.RoleUsrInCrs.Role;
|
||||||
|
|
|
@ -1184,9 +1184,12 @@ static void Soc_SaveWhichUsersInDB (void)
|
||||||
static void Soc_ShowWarningYouDontFollowAnyUser (void)
|
static void Soc_ShowWarningYouDontFollowAnyUser (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_You_dont_follow_any_user;
|
extern const char *Txt_You_dont_follow_any_user;
|
||||||
|
unsigned NumFollowing;
|
||||||
|
unsigned NumFollowers;
|
||||||
|
|
||||||
/***** Check if I follow someone *****/
|
/***** Check if I follow someone *****/
|
||||||
if (!Fol_GetNumFollowing (Gbl.Usrs.Me.UsrDat.UsrCod))
|
Fol_GetNumFollow (Gbl.Usrs.Me.UsrDat.UsrCod,&NumFollowing,&NumFollowers);
|
||||||
|
if (!NumFollowing)
|
||||||
{
|
{
|
||||||
/***** Show warning if I do not follow anyone *****/
|
/***** Show warning if I do not follow anyone *****/
|
||||||
Ale_ShowAlert (Ale_WARNING,Txt_You_dont_follow_any_user);
|
Ale_ShowAlert (Ale_WARNING,Txt_You_dont_follow_any_user);
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "swad_database.h"
|
#include "swad_database.h"
|
||||||
#include "swad_duplicate.h"
|
#include "swad_duplicate.h"
|
||||||
#include "swad_enrolment.h"
|
#include "swad_enrolment.h"
|
||||||
|
#include "swad_follow.h"
|
||||||
#include "swad_form.h"
|
#include "swad_form.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
#include "swad_group.h"
|
#include "swad_group.h"
|
||||||
|
@ -830,6 +831,7 @@ void Usr_FlushCachesUsr (void)
|
||||||
Rol_FlushCacheRoleUsrInCrs ();
|
Rol_FlushCacheRoleUsrInCrs ();
|
||||||
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
Grp_FlushCacheUsrSharesAnyOfMyGrpsInCurrentCrs ();
|
||||||
Grp_FlushCacheIBelongToGrp ();
|
Grp_FlushCacheIBelongToGrp ();
|
||||||
|
Fol_FlushCacheFollow ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user