From 9bc3e2e4466d9bd2759b9c45fed99828de7bd6c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 27 Jan 2016 22:31:36 +0100 Subject: [PATCH] Version 15.132 --- sql/swad.sql | 2 + swad_action.c | 3 + swad_action.h | 279 ++++++++++++++++++++++++----------------------- swad_changelog.h | 23 ++-- swad_database.c | 11 +- swad_follow.c | 71 ++++++++++++ swad_follow.h | 3 + swad_profile.c | 6 + swad_social.c | 10 +- swad_text.c | 21 ++++ swad_user.c | 2 +- 11 files changed, 269 insertions(+), 162 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index a0cc5dcb..03d2925c 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -1222,6 +1222,8 @@ CREATE TABLE IF NOT EXISTS usr_data ( INDEX(IconSet), INDEX(Language), INDEX(FirstDayOfWeek), + INDEX(PhotoVisibility), + INDEX(ProfileVisibility), INDEX(CtyCod), INDEX(InsCtyCod), INDEX(InsCod), diff --git a/swad_action.c b/swad_action.c index d2f70d98..d4577e4b 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1038,6 +1038,7 @@ Social: 869. ActCalNumForPst Calculate number of forum posts and store into user's figures 870. ActCalNumMsgSnt Calculate number of messages sent from log and store into user's figures +NEW.....871. ActWhoFol Suggest list of users to follow 871. ActFolUsr Follow another user 872. ActUnfUsr Unfollow another user 873. ActSeeFlg Show following @@ -2374,6 +2375,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActCalNumForPst */{1408,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumForPst ,NULL}, /* ActCalNumMsgSnt */{1407,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Prf_CalculateNumMsgSnt ,NULL}, + /* ActWhoFol */{1520,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Fol_SuggestWhoToFollow ,NULL}, /* ActFolUsr */{1410,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Fol_FollowUsr ,NULL}, /* ActUnfUsr */{1411,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Fol_UnfollowUsr ,NULL}, /* ActSeeFlg */{1412,-1,TabSoc,ActReqPubPrf ,0x1FF,0x1FF,0x1FF,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Fol_ListFollowing ,NULL}, @@ -4233,6 +4235,7 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq ActUnfSocComGbl, // #1517 ActFavSocComUsr, // #1518 ActUnfSocComUsr, // #1519 + ActWhoFol, // #1520 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 854c2872..f2e2ddd3 100644 --- a/swad_action.h +++ b/swad_action.h @@ -71,9 +71,9 @@ typedef enum typedef int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (1+9+52+15+90+72+67+205+183+143+171+36+27+82) +#define Act_NUM_ACTIONS (1+9+52+15+90+72+67+205+183+143+172+36+27+82) -#define Act_MAX_ACTION_COD 1519 +#define Act_MAX_ACTION_COD 1520 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20 @@ -1080,145 +1080,146 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica #define ActCalNumForPst (ActLstClk+ 33) #define ActCalNumMsgSnt (ActLstClk+ 34) -#define ActFolUsr (ActLstClk+ 35) -#define ActUnfUsr (ActLstClk+ 36) -#define ActSeeFlg (ActLstClk+ 37) -#define ActSeeFlr (ActLstClk+ 38) +#define ActWhoFol (ActLstClk+ 35) +#define ActFolUsr (ActLstClk+ 36) +#define ActUnfUsr (ActLstClk+ 37) +#define ActSeeFlg (ActLstClk+ 38) +#define ActSeeFlr (ActLstClk+ 39) -#define ActSeeForCrsUsr (ActLstClk+ 39) -#define ActSeeForCrsTch (ActLstClk+ 40) -#define ActSeeForDegUsr (ActLstClk+ 41) -#define ActSeeForDegTch (ActLstClk+ 42) -#define ActSeeForCtrUsr (ActLstClk+ 43) -#define ActSeeForCtrTch (ActLstClk+ 44) -#define ActSeeForInsUsr (ActLstClk+ 45) -#define ActSeeForInsTch (ActLstClk+ 46) -#define ActSeeForGenUsr (ActLstClk+ 47) -#define ActSeeForGenTch (ActLstClk+ 48) -#define ActSeeForSWAUsr (ActLstClk+ 49) -#define ActSeeForSWATch (ActLstClk+ 50) -#define ActSeePstForCrsUsr (ActLstClk+ 51) -#define ActSeePstForCrsTch (ActLstClk+ 52) -#define ActSeePstForDegUsr (ActLstClk+ 53) -#define ActSeePstForDegTch (ActLstClk+ 54) -#define ActSeePstForCtrUsr (ActLstClk+ 55) -#define ActSeePstForCtrTch (ActLstClk+ 56) -#define ActSeePstForInsUsr (ActLstClk+ 57) -#define ActSeePstForInsTch (ActLstClk+ 58) -#define ActSeePstForGenUsr (ActLstClk+ 59) -#define ActSeePstForGenTch (ActLstClk+ 60) -#define ActSeePstForSWAUsr (ActLstClk+ 61) -#define ActSeePstForSWATch (ActLstClk+ 62) -#define ActRcvThrForCrsUsr (ActLstClk+ 63) -#define ActRcvThrForCrsTch (ActLstClk+ 64) -#define ActRcvThrForDegUsr (ActLstClk+ 65) -#define ActRcvThrForDegTch (ActLstClk+ 66) -#define ActRcvThrForCtrUsr (ActLstClk+ 67) -#define ActRcvThrForCtrTch (ActLstClk+ 68) -#define ActRcvThrForInsUsr (ActLstClk+ 69) -#define ActRcvThrForInsTch (ActLstClk+ 70) -#define ActRcvThrForGenUsr (ActLstClk+ 71) -#define ActRcvThrForGenTch (ActLstClk+ 72) -#define ActRcvThrForSWAUsr (ActLstClk+ 73) -#define ActRcvThrForSWATch (ActLstClk+ 74) -#define ActRcvRepForCrsUsr (ActLstClk+ 75) -#define ActRcvRepForCrsTch (ActLstClk+ 76) -#define ActRcvRepForDegUsr (ActLstClk+ 77) -#define ActRcvRepForDegTch (ActLstClk+ 78) -#define ActRcvRepForCtrUsr (ActLstClk+ 79) -#define ActRcvRepForCtrTch (ActLstClk+ 80) -#define ActRcvRepForInsUsr (ActLstClk+ 81) -#define ActRcvRepForInsTch (ActLstClk+ 82) -#define ActRcvRepForGenUsr (ActLstClk+ 83) -#define ActRcvRepForGenTch (ActLstClk+ 84) -#define ActRcvRepForSWAUsr (ActLstClk+ 85) -#define ActRcvRepForSWATch (ActLstClk+ 86) -#define ActReqDelThrCrsUsr (ActLstClk+ 87) -#define ActReqDelThrCrsTch (ActLstClk+ 88) -#define ActReqDelThrDegUsr (ActLstClk+ 89) -#define ActReqDelThrDegTch (ActLstClk+ 90) -#define ActReqDelThrCtrUsr (ActLstClk+ 91) -#define ActReqDelThrCtrTch (ActLstClk+ 92) -#define ActReqDelThrInsUsr (ActLstClk+ 93) -#define ActReqDelThrInsTch (ActLstClk+ 94) -#define ActReqDelThrGenUsr (ActLstClk+ 95) -#define ActReqDelThrGenTch (ActLstClk+ 96) -#define ActReqDelThrSWAUsr (ActLstClk+ 97) -#define ActReqDelThrSWATch (ActLstClk+ 98) -#define ActDelThrForCrsUsr (ActLstClk+ 99) -#define ActDelThrForCrsTch (ActLstClk+100) -#define ActDelThrForDegUsr (ActLstClk+101) -#define ActDelThrForDegTch (ActLstClk+102) -#define ActDelThrForCtrUsr (ActLstClk+103) -#define ActDelThrForCtrTch (ActLstClk+104) -#define ActDelThrForInsUsr (ActLstClk+105) -#define ActDelThrForInsTch (ActLstClk+106) -#define ActDelThrForGenUsr (ActLstClk+107) -#define ActDelThrForGenTch (ActLstClk+108) -#define ActDelThrForSWAUsr (ActLstClk+109) -#define ActDelThrForSWATch (ActLstClk+110) -#define ActCutThrForCrsUsr (ActLstClk+111) -#define ActCutThrForCrsTch (ActLstClk+112) -#define ActCutThrForDegUsr (ActLstClk+113) -#define ActCutThrForDegTch (ActLstClk+114) -#define ActCutThrForCtrUsr (ActLstClk+115) -#define ActCutThrForCtrTch (ActLstClk+116) -#define ActCutThrForInsUsr (ActLstClk+117) -#define ActCutThrForInsTch (ActLstClk+118) -#define ActCutThrForGenUsr (ActLstClk+119) -#define ActCutThrForGenTch (ActLstClk+120) -#define ActCutThrForSWAUsr (ActLstClk+121) -#define ActCutThrForSWATch (ActLstClk+122) -#define ActPasThrForCrsUsr (ActLstClk+123) -#define ActPasThrForCrsTch (ActLstClk+124) -#define ActPasThrForDegUsr (ActLstClk+125) -#define ActPasThrForDegTch (ActLstClk+126) -#define ActPasThrForCtrUsr (ActLstClk+127) -#define ActPasThrForCtrTch (ActLstClk+128) -#define ActPasThrForInsUsr (ActLstClk+129) -#define ActPasThrForInsTch (ActLstClk+130) -#define ActPasThrForGenUsr (ActLstClk+131) -#define ActPasThrForGenTch (ActLstClk+132) -#define ActPasThrForSWAUsr (ActLstClk+133) -#define ActPasThrForSWATch (ActLstClk+134) -#define ActDelPstForCrsUsr (ActLstClk+135) -#define ActDelPstForCrsTch (ActLstClk+136) -#define ActDelPstForDegUsr (ActLstClk+137) -#define ActDelPstForDegTch (ActLstClk+138) -#define ActDelPstForCtrUsr (ActLstClk+139) -#define ActDelPstForCtrTch (ActLstClk+140) -#define ActDelPstForInsUsr (ActLstClk+141) -#define ActDelPstForInsTch (ActLstClk+142) -#define ActDelPstForGenUsr (ActLstClk+143) -#define ActDelPstForGenTch (ActLstClk+144) -#define ActDelPstForSWAUsr (ActLstClk+145) -#define ActDelPstForSWATch (ActLstClk+146) -#define ActEnbPstForCrsUsr (ActLstClk+147) -#define ActEnbPstForCrsTch (ActLstClk+148) -#define ActEnbPstForDegUsr (ActLstClk+149) -#define ActEnbPstForDegTch (ActLstClk+150) -#define ActEnbPstForCtrUsr (ActLstClk+151) -#define ActEnbPstForCtrTch (ActLstClk+152) -#define ActEnbPstForInsUsr (ActLstClk+153) -#define ActEnbPstForInsTch (ActLstClk+154) -#define ActEnbPstForGenUsr (ActLstClk+155) -#define ActEnbPstForGenTch (ActLstClk+156) -#define ActEnbPstForSWAUsr (ActLstClk+157) -#define ActEnbPstForSWATch (ActLstClk+158) -#define ActDisPstForCrsUsr (ActLstClk+159) -#define ActDisPstForCrsTch (ActLstClk+160) -#define ActDisPstForDegUsr (ActLstClk+161) -#define ActDisPstForDegTch (ActLstClk+162) -#define ActDisPstForCtrUsr (ActLstClk+163) -#define ActDisPstForCtrTch (ActLstClk+164) -#define ActDisPstForInsUsr (ActLstClk+165) -#define ActDisPstForInsTch (ActLstClk+166) -#define ActDisPstForGenUsr (ActLstClk+167) -#define ActDisPstForGenTch (ActLstClk+168) -#define ActDisPstForSWAUsr (ActLstClk+169) -#define ActDisPstForSWATch (ActLstClk+170) +#define ActSeeForCrsUsr (ActLstClk+ 40) +#define ActSeeForCrsTch (ActLstClk+ 41) +#define ActSeeForDegUsr (ActLstClk+ 42) +#define ActSeeForDegTch (ActLstClk+ 43) +#define ActSeeForCtrUsr (ActLstClk+ 44) +#define ActSeeForCtrTch (ActLstClk+ 45) +#define ActSeeForInsUsr (ActLstClk+ 46) +#define ActSeeForInsTch (ActLstClk+ 47) +#define ActSeeForGenUsr (ActLstClk+ 48) +#define ActSeeForGenTch (ActLstClk+ 49) +#define ActSeeForSWAUsr (ActLstClk+ 50) +#define ActSeeForSWATch (ActLstClk+ 51) +#define ActSeePstForCrsUsr (ActLstClk+ 52) +#define ActSeePstForCrsTch (ActLstClk+ 53) +#define ActSeePstForDegUsr (ActLstClk+ 54) +#define ActSeePstForDegTch (ActLstClk+ 55) +#define ActSeePstForCtrUsr (ActLstClk+ 56) +#define ActSeePstForCtrTch (ActLstClk+ 57) +#define ActSeePstForInsUsr (ActLstClk+ 58) +#define ActSeePstForInsTch (ActLstClk+ 59) +#define ActSeePstForGenUsr (ActLstClk+ 60) +#define ActSeePstForGenTch (ActLstClk+ 61) +#define ActSeePstForSWAUsr (ActLstClk+ 62) +#define ActSeePstForSWATch (ActLstClk+ 63) +#define ActRcvThrForCrsUsr (ActLstClk+ 64) +#define ActRcvThrForCrsTch (ActLstClk+ 65) +#define ActRcvThrForDegUsr (ActLstClk+ 66) +#define ActRcvThrForDegTch (ActLstClk+ 67) +#define ActRcvThrForCtrUsr (ActLstClk+ 68) +#define ActRcvThrForCtrTch (ActLstClk+ 69) +#define ActRcvThrForInsUsr (ActLstClk+ 70) +#define ActRcvThrForInsTch (ActLstClk+ 71) +#define ActRcvThrForGenUsr (ActLstClk+ 72) +#define ActRcvThrForGenTch (ActLstClk+ 73) +#define ActRcvThrForSWAUsr (ActLstClk+ 74) +#define ActRcvThrForSWATch (ActLstClk+ 75) +#define ActRcvRepForCrsUsr (ActLstClk+ 76) +#define ActRcvRepForCrsTch (ActLstClk+ 77) +#define ActRcvRepForDegUsr (ActLstClk+ 78) +#define ActRcvRepForDegTch (ActLstClk+ 79) +#define ActRcvRepForCtrUsr (ActLstClk+ 80) +#define ActRcvRepForCtrTch (ActLstClk+ 81) +#define ActRcvRepForInsUsr (ActLstClk+ 82) +#define ActRcvRepForInsTch (ActLstClk+ 83) +#define ActRcvRepForGenUsr (ActLstClk+ 84) +#define ActRcvRepForGenTch (ActLstClk+ 85) +#define ActRcvRepForSWAUsr (ActLstClk+ 86) +#define ActRcvRepForSWATch (ActLstClk+ 87) +#define ActReqDelThrCrsUsr (ActLstClk+ 88) +#define ActReqDelThrCrsTch (ActLstClk+ 89) +#define ActReqDelThrDegUsr (ActLstClk+ 90) +#define ActReqDelThrDegTch (ActLstClk+ 91) +#define ActReqDelThrCtrUsr (ActLstClk+ 92) +#define ActReqDelThrCtrTch (ActLstClk+ 93) +#define ActReqDelThrInsUsr (ActLstClk+ 94) +#define ActReqDelThrInsTch (ActLstClk+ 95) +#define ActReqDelThrGenUsr (ActLstClk+ 96) +#define ActReqDelThrGenTch (ActLstClk+ 97) +#define ActReqDelThrSWAUsr (ActLstClk+ 98) +#define ActReqDelThrSWATch (ActLstClk+ 99) +#define ActDelThrForCrsUsr (ActLstClk+100) +#define ActDelThrForCrsTch (ActLstClk+101) +#define ActDelThrForDegUsr (ActLstClk+102) +#define ActDelThrForDegTch (ActLstClk+103) +#define ActDelThrForCtrUsr (ActLstClk+104) +#define ActDelThrForCtrTch (ActLstClk+105) +#define ActDelThrForInsUsr (ActLstClk+106) +#define ActDelThrForInsTch (ActLstClk+107) +#define ActDelThrForGenUsr (ActLstClk+108) +#define ActDelThrForGenTch (ActLstClk+109) +#define ActDelThrForSWAUsr (ActLstClk+110) +#define ActDelThrForSWATch (ActLstClk+111) +#define ActCutThrForCrsUsr (ActLstClk+112) +#define ActCutThrForCrsTch (ActLstClk+113) +#define ActCutThrForDegUsr (ActLstClk+114) +#define ActCutThrForDegTch (ActLstClk+115) +#define ActCutThrForCtrUsr (ActLstClk+116) +#define ActCutThrForCtrTch (ActLstClk+117) +#define ActCutThrForInsUsr (ActLstClk+118) +#define ActCutThrForInsTch (ActLstClk+119) +#define ActCutThrForGenUsr (ActLstClk+120) +#define ActCutThrForGenTch (ActLstClk+121) +#define ActCutThrForSWAUsr (ActLstClk+122) +#define ActCutThrForSWATch (ActLstClk+123) +#define ActPasThrForCrsUsr (ActLstClk+124) +#define ActPasThrForCrsTch (ActLstClk+125) +#define ActPasThrForDegUsr (ActLstClk+126) +#define ActPasThrForDegTch (ActLstClk+127) +#define ActPasThrForCtrUsr (ActLstClk+128) +#define ActPasThrForCtrTch (ActLstClk+129) +#define ActPasThrForInsUsr (ActLstClk+130) +#define ActPasThrForInsTch (ActLstClk+131) +#define ActPasThrForGenUsr (ActLstClk+132) +#define ActPasThrForGenTch (ActLstClk+133) +#define ActPasThrForSWAUsr (ActLstClk+134) +#define ActPasThrForSWATch (ActLstClk+135) +#define ActDelPstForCrsUsr (ActLstClk+136) +#define ActDelPstForCrsTch (ActLstClk+137) +#define ActDelPstForDegUsr (ActLstClk+138) +#define ActDelPstForDegTch (ActLstClk+139) +#define ActDelPstForCtrUsr (ActLstClk+140) +#define ActDelPstForCtrTch (ActLstClk+141) +#define ActDelPstForInsUsr (ActLstClk+142) +#define ActDelPstForInsTch (ActLstClk+143) +#define ActDelPstForGenUsr (ActLstClk+144) +#define ActDelPstForGenTch (ActLstClk+145) +#define ActDelPstForSWAUsr (ActLstClk+146) +#define ActDelPstForSWATch (ActLstClk+147) +#define ActEnbPstForCrsUsr (ActLstClk+148) +#define ActEnbPstForCrsTch (ActLstClk+149) +#define ActEnbPstForDegUsr (ActLstClk+150) +#define ActEnbPstForDegTch (ActLstClk+151) +#define ActEnbPstForCtrUsr (ActLstClk+152) +#define ActEnbPstForCtrTch (ActLstClk+153) +#define ActEnbPstForInsUsr (ActLstClk+154) +#define ActEnbPstForInsTch (ActLstClk+155) +#define ActEnbPstForGenUsr (ActLstClk+156) +#define ActEnbPstForGenTch (ActLstClk+157) +#define ActEnbPstForSWAUsr (ActLstClk+158) +#define ActEnbPstForSWATch (ActLstClk+159) +#define ActDisPstForCrsUsr (ActLstClk+160) +#define ActDisPstForCrsTch (ActLstClk+161) +#define ActDisPstForDegUsr (ActLstClk+162) +#define ActDisPstForDegTch (ActLstClk+163) +#define ActDisPstForCtrUsr (ActLstClk+164) +#define ActDisPstForCtrTch (ActLstClk+165) +#define ActDisPstForInsUsr (ActLstClk+166) +#define ActDisPstForInsTch (ActLstClk+167) +#define ActDisPstForGenUsr (ActLstClk+168) +#define ActDisPstForGenTch (ActLstClk+169) +#define ActDisPstForSWAUsr (ActLstClk+170) +#define ActDisPstForSWATch (ActLstClk+171) -#define ActCht (ActLstClk+171) +#define ActCht (ActLstClk+172) /*****************************************************************************/ /******************************* Messages tab ********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index fc8b6066..57356158 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -118,33 +118,24 @@ // TODO: Width of column for data in notifications is too short // TODO: Recommendations about users to follow -/* The query can be something like this: -SELECT DISTINCT usr_follow.FollowedCod,usr_data.Surname1,usr_data.Surname2,usr_data.FirstName,usr_nicknames.Nickname - FROM usr_follow,usr_data,usr_nicknames - WHERE usr_follow.FollowerCod IN (SELECT FollowedCod FROM usr_follow WHERE FollowerCod='1346') - AND usr_follow.FollowedCod NOT IN (SELECT FollowedCod FROM usr_follow WHERE FollowerCod='1346') - AND usr_follow.FollowedCod<>'1346' - AND usr_follow.FollowedCod=usr_data.UsrCod - AND (usr_data.ProfileVisibility IN ('system','world') - OR (usr_data.ProfileVisibility='course' - AND usr_data.UsrCod IN - (SELECT UsrCod FROM crs_usr WHERE CrsCod IN - (SELECT CrsCod FROM crs_usr WHERE UsrCod='1346')))) - AND usr_follow.FollowedCod=usr_nicknames.UsrCod ORDER BY RAND() LIMIT 3; - - */ /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.131.4 (2016-01-27)" +#define Log_PLATFORM_VERSION "SWAD 15.132 (2016-01-27)" #define CSS_FILE "swad15.131.2.css" #define JS_FILE "swad15.131.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 15.132: Jan 27, 2016 Put link to suggest users to follow. (195116 lines) + 2 changes necessary in database: +CREATE INDEX PhotoVisibility ON usr_data (PhotoVisibility); +CREATE INDEX ProfileVisibility ON usr_data (ProfileVisibility); + Version 15.131.4: Jan 27, 2016 Fixed bug in ranking of followed. (195030 lines) Version 15.131.3: Jan 27, 2016 Animated link to view old timeline. (195015 lines) Version 15.131.2: Jan 26, 2016 Change in default color of links. (194998 lines) diff --git a/swad_database.c b/swad_database.c index 12d92db3..5f1ef2f4 100644 --- a/swad_database.c +++ b/swad_database.c @@ -2520,13 +2520,14 @@ mysql> DESCRIBE usr_data; | Surname2 | varchar(32) | NO | | NULL | | | FirstName | varchar(32) | NO | | NULL | | | Sex | enum('unknown','female','male') | NO | | unknown | | +| Layout | tinyint(4) | NO | MUL | 0 | | | Theme | char(16) | NO | MUL | NULL | | | IconSet | char(16) | NO | MUL | NULL | | | Language | char(2) | NO | MUL | NULL | | | FirstDayOfWeek | tinyint(4) | NO | MUL | 0 | | | Photo | char(43) | NO | | NULL | | -| PhotoVisibility | enum('unknown','user','course','system','world') | NO | | unknown | | -| ProfileVisibility | enum('unknown','user','course','system','world') | NO | | unknown | | +| PhotoVisibility | enum('unknown','user','course','system','world') | NO | MUL | unknown | | +| ProfileVisibility | enum('unknown','user','course','system','world') | NO | MUL | unknown | | | CtyCod | int(11) | NO | MUL | -1 | | | InsCtyCod | int(11) | NO | MUL | -1 | | | InsCod | int(11) | NO | MUL | -1 | | @@ -2543,10 +2544,10 @@ mysql> DESCRIBE usr_data; | Comments | text | NO | | NULL | | | Menu | tinyint(4) | NO | MUL | 0 | | | SideCols | tinyint(4) | NO | MUL | 3 | | -| NotifNtfEvents | int(11) | NO | | 0 | | +| NotifNtfEvents | int(11) | NO | | -1 | | | EmailNtfEvents | int(11) | NO | | 0 | | +-------------------+--------------------------------------------------+------+-----+---------+----------------+ -32 rows in set (0.00 sec) +33 rows in set (0.01 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_data (" "UsrCod INT NOT NULL AUTO_INCREMENT," @@ -2587,6 +2588,8 @@ mysql> DESCRIBE usr_data; "INDEX(IconSet)," "INDEX(Language)," "INDEX(FirstDayOfWeek)," + "INDEX(PhotoVisibility)," + "INDEX(ProfileVisibility)," "INDEX(CtyCod)," "INDEX(InsCtyCod)," "INDEX(InsCod)," diff --git a/swad_follow.c b/swad_follow.c index d738f599..89ef4489 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -70,6 +70,77 @@ static void Fol_ShowNumberOfFollowingOrFollowers (const struct UsrData *UsrDat, const char *Title); static void Fol_ShowFollowedOrFollower (const struct UsrData *UsrDat); +/*****************************************************************************/ +/******************** Put link to suggest users to follow ********************/ +/*****************************************************************************/ + +void Fol_PutLinkWhoToFollow (void) + { + extern const char *Txt_Who_to_follow; + + fprintf (Gbl.F.Out,"
"); + Lay_PutContextualLink (ActWhoFol,NULL, + "follow64x64.png", + Txt_Who_to_follow,Txt_Who_to_follow); + fprintf (Gbl.F.Out,"
"); + } + +/*****************************************************************************/ +/******************** Put link to suggest users to follow ********************/ +/*****************************************************************************/ + +void Fol_SuggestWhoToFollow (void) + { +/* The query can be something like this: + + SELECT UsrCod FROM + ( + + SELECT DISTINCT usr_follow.FollowedCod AS UsrCod + FROM usr_follow, + (SELECT FollowedCod FROM usr_follow + WHERE FollowerCod='1346') AS my_followed, + usr_data + WHERE usr_follow.FollowerCod=my_followed.FollowedCod + AND usr_follow.FollowedCod<>'1346' + AND usr_follow.FollowedCod=usr_data.UsrCod + AND usr_data.ProfileVisibility IN ('system','world') + + UNION + + SELECT DISTINCT crs_usr.UsrCod + FROM crs_usr, + (SELECT CrsCod FROM crs_usr + WHERE UsrCod='1346') AS my_crs, + usr_data + WHERE crs_usr.CrsCod=my_crs.CrsCod + AND crs_usr.UsrCod<>'1346' + AND crs_usr.UsrCod=usr_data.UsrCod + AND usr_data.ProfileVisibility='course' + + UNION + + SELECT DISTINCT crs_usr.UsrCod + FROM crs_usr, + (SELECT CrsCod,Role FROM crs_usr WHERE + UsrCod='1346') AS my_crs_role, + usr_data + WHERE crs_usr.CrsCod=my_crs_role.CrsCod + AND crs_usr.Role<>my_crs_role.Role + AND crs_usr.UsrCod=usr_data.UsrCod + AND usr_data.ProfileVisibility='user' + + ) AS UsrsToFollow + + WHERE UsrCod NOT IN + (SELECT FollowedCod FROM usr_follow + WHERE FollowerCod='1346') + + ORDER BY RAND() LIMIT 3; + + */ + } + /*****************************************************************************/ /*************** Check if a user is a follower of another user ***************/ /*****************************************************************************/ diff --git a/swad_follow.h b/swad_follow.h index 049e5559..1a407d17 100644 --- a/swad_follow.h +++ b/swad_follow.h @@ -43,6 +43,9 @@ /****************************** Public prototypes ****************************/ /*****************************************************************************/ +void Fol_PutLinkWhoToFollow (void); +void Fol_SuggestWhoToFollow (void); + bool Fol_CheckUsrIsFollowerOf (long FollowerCod,long FollowedCod); unsigned Fol_GetNumFollowing (long UsrCod); unsigned Fol_GetNumFollowers (long UsrCod); diff --git a/swad_profile.c b/swad_profile.c index 62dbc46e..7f7f4c25 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -127,6 +127,9 @@ char *Prf_GetURLPublicProfile (char *URL,const char *NicknameWithoutArroba) void Prf_RequestUserProfile (void) { + /***** Put links to suggests users to follow *****/ + Fol_PutLinkWhoToFollow (); + /* By default, the nickname is filled with my nickname If no user logged ==> the nickname is empty */ Prf_RequestUserProfileWithDefaultNickname (Gbl.Usrs.Me.UsrDat.Nickname); @@ -189,6 +192,9 @@ void Prf_GetUsrDatAndShowUserProfile (void) if (Error) { + /***** Put links to suggests users to follow *****/ + Fol_PutLinkWhoToFollow (); + /* Show error message */ Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); diff --git a/swad_social.c b/swad_social.c index 22ec9864..0f511b31 100644 --- a/swad_social.c +++ b/swad_social.c @@ -332,9 +332,15 @@ static void Soc_ShowTimelineGblHighlightingNot (long NotCod) extern const char *Txt_You_dont_follow_any_user; char Query[1024]; - /***** Show warning if I do not follow anyone *****/ + /***** Check if I follow someone *****/ if (!Fol_GetNumFollowing (Gbl.Usrs.Me.UsrDat.UsrCod)) - Lay_ShowAlert (Lay_INFO,Txt_You_dont_follow_any_user); + { + /***** Put links to suggests users to follow *****/ + Fol_PutLinkWhoToFollow (); + + /***** Show warning if I do not follow anyone *****/ + Lay_ShowAlert (Lay_WARNING,Txt_You_dont_follow_any_user); + } /***** Build query to get timeline *****/ Soc_BuildQueryToGetTimeline (Soc_TIMELINE_GBL, diff --git a/swad_text.c b/swad_text.c index 7fad3605..e7783259 100644 --- a/swad_text.c +++ b/swad_text.c @@ -49201,6 +49201,27 @@ const char *Txt_What_would_you_like_to_do = "O que você faria?"; #endif +const char *Txt_Who_to_follow = +#if L==1 + "A qui seguir"; +#elif L==2 + "Wer zu folgen"; +#elif L==3 + "Who to follow"; +#elif L==4 + "A quién seguir"; +#elif L==5 + "Qui à suivre"; +#elif L==6 + "A quién seguir"; // Okoteve traducción +#elif L==7 + "Chi da seguire"; +#elif L==8 + "Kto do naśladowania"; +#elif L==9 + "Quem seguir"; +#endif + const char *Txt_With_centres = #if L==1 "Amb centres"; diff --git a/swad_user.c b/swad_user.c index 48673bea..f3dbc290 100644 --- a/swad_user.c +++ b/swad_user.c @@ -858,7 +858,7 @@ bool Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod) "(SELECT CrsCod,Role FROM crs_usr WHERE UsrCod='%ld') AS my_courses," "(SELECT CrsCod,Role FROM crs_usr WHERE UsrCod='%ld') AS usr_courses" " WHERE my_courses.CrsCod=usr_courses.CrsCod" - " AND my_courses.Role!=usr_courses.Role", + " AND my_courses.Role<>usr_courses.Role", Gbl.Usrs.Me.UsrDat.UsrCod,UsrCod); return (DB_QueryCOUNT (Query,"can not check if a user shares any course with you") != 0); }