From b7515fc1d7925f400fd3763a7c8beb6207fdb0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Fri, 17 Feb 2017 06:32:57 +0100 Subject: [PATCH] Version 16.139 --- swad_action.c | 2 - swad_action.h | 291 +++++++++++++++++++++++------------------------ swad_changelog.h | 6 +- swad_parameter.c | 5 +- swad_photo.c | 24 +--- swad_profile.c | 93 +++++++-------- swad_profile.h | 1 - swad_record.c | 31 ++--- swad_social.c | 108 ++++++------------ swad_user.c | 5 + swad_user.h | 1 + 11 files changed, 256 insertions(+), 311 deletions(-) diff --git a/swad_action.c b/swad_action.c index 7dab7091..853402fe 100644 --- a/swad_action.c +++ b/swad_action.c @@ -2621,7 +2621,6 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActReqRemSocComGbl*/{1506,-1,TabUnk,ActSeeSocPrf ,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Soc_RequestRemSocialComUsr ,NULL}, /* ActRemSocComGbl */{1508,-1,TabUnk,ActSeeSocPrf ,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Soc_RemoveSocialComUsr ,NULL}, - /* ActSeeMyPubPrf */{1637,-1,TabUnk,ActSeeSocPrf ,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,0x1FE,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Prf_ShowMyProfile ,NULL}, /* ActSeeOthPubPrf */{1402,-1,TabUnk,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Prf_GetUsrDatAndShowUserProfile,NULL}, /* ActCal1stClkTim */{1405,-1,TabUnk,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Prf_CalculateFigures ,NULL}, /* ActCalNumClk */{1406,-1,TabUnk,ActSeeSocPrf ,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,0x1FF,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Prf_CalculateFigures ,NULL}, @@ -4623,7 +4622,6 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActSeeCalDeg, // #1634 ActPrnCalDeg, // #1635 ActChgCalDeg1stDay, // #1636 - ActSeeMyPubPrf, // #1637 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index d168e251..fb52283b 100644 --- a/swad_action.h +++ b/swad_action.h @@ -55,9 +55,9 @@ typedef enum typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (1 + 9 + 54 + 17 + 47 + 27 + 24 + 115 + 54 + 416 + 159 + 173 + 36 + 31 + 97) +#define Act_NUM_ACTIONS (1 + 9 + 54 + 17 + 47 + 27 + 24 + 115 + 54 + 416 + 159 + 172 + 36 + 31 + 97) -#define Act_MAX_ACTION_COD 1637 +#define Act_MAX_ACTION_COD 1636 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 12 @@ -1165,153 +1165,152 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActReqRemSocComUsr (ActLstClk + 28) #define ActRemSocComUsr (ActLstClk + 29) -#define ActSeeMyPubPrf (ActLstClk + 30) -#define ActSeeOthPubPrf (ActLstClk + 31) -#define ActCal1stClkTim (ActLstClk + 32) -#define ActCalNumClk (ActLstClk + 33) -#define ActCalNumFilVie (ActLstClk + 34) -#define ActCalNumForPst (ActLstClk + 35) -#define ActCalNumMsgSnt (ActLstClk + 36) +#define ActSeeOthPubPrf (ActLstClk + 30) +#define ActCal1stClkTim (ActLstClk + 31) +#define ActCalNumClk (ActLstClk + 32) +#define ActCalNumFilVie (ActLstClk + 33) +#define ActCalNumForPst (ActLstClk + 34) +#define ActCalNumMsgSnt (ActLstClk + 35) -#define ActFolUsr (ActLstClk + 37) -#define ActUnfUsr (ActLstClk + 38) -#define ActSeeFlg (ActLstClk + 39) -#define ActSeeFlr (ActLstClk + 40) +#define ActFolUsr (ActLstClk + 36) +#define ActUnfUsr (ActLstClk + 37) +#define ActSeeFlg (ActLstClk + 38) +#define ActSeeFlr (ActLstClk + 39) -#define ActSeeForCrsUsr (ActLstClk + 41) -#define ActSeeForCrsTch (ActLstClk + 42) -#define ActSeeForDegUsr (ActLstClk + 43) -#define ActSeeForDegTch (ActLstClk + 44) -#define ActSeeForCtrUsr (ActLstClk + 45) -#define ActSeeForCtrTch (ActLstClk + 46) -#define ActSeeForInsUsr (ActLstClk + 47) -#define ActSeeForInsTch (ActLstClk + 48) -#define ActSeeForGenUsr (ActLstClk + 49) -#define ActSeeForGenTch (ActLstClk + 50) -#define ActSeeForSWAUsr (ActLstClk + 51) -#define ActSeeForSWATch (ActLstClk + 52) -#define ActSeePstForCrsUsr (ActLstClk + 53) -#define ActSeePstForCrsTch (ActLstClk + 54) -#define ActSeePstForDegUsr (ActLstClk + 55) -#define ActSeePstForDegTch (ActLstClk + 56) -#define ActSeePstForCtrUsr (ActLstClk + 57) -#define ActSeePstForCtrTch (ActLstClk + 58) -#define ActSeePstForInsUsr (ActLstClk + 59) -#define ActSeePstForInsTch (ActLstClk + 60) -#define ActSeePstForGenUsr (ActLstClk + 61) -#define ActSeePstForGenTch (ActLstClk + 62) -#define ActSeePstForSWAUsr (ActLstClk + 63) -#define ActSeePstForSWATch (ActLstClk + 64) -#define ActRcvThrForCrsUsr (ActLstClk + 65) -#define ActRcvThrForCrsTch (ActLstClk + 66) -#define ActRcvThrForDegUsr (ActLstClk + 67) -#define ActRcvThrForDegTch (ActLstClk + 68) -#define ActRcvThrForCtrUsr (ActLstClk + 69) -#define ActRcvThrForCtrTch (ActLstClk + 70) -#define ActRcvThrForInsUsr (ActLstClk + 71) -#define ActRcvThrForInsTch (ActLstClk + 72) -#define ActRcvThrForGenUsr (ActLstClk + 73) -#define ActRcvThrForGenTch (ActLstClk + 74) -#define ActRcvThrForSWAUsr (ActLstClk + 75) -#define ActRcvThrForSWATch (ActLstClk + 76) -#define ActRcvRepForCrsUsr (ActLstClk + 77) -#define ActRcvRepForCrsTch (ActLstClk + 78) -#define ActRcvRepForDegUsr (ActLstClk + 79) -#define ActRcvRepForDegTch (ActLstClk + 80) -#define ActRcvRepForCtrUsr (ActLstClk + 81) -#define ActRcvRepForCtrTch (ActLstClk + 82) -#define ActRcvRepForInsUsr (ActLstClk + 83) -#define ActRcvRepForInsTch (ActLstClk + 84) -#define ActRcvRepForGenUsr (ActLstClk + 85) -#define ActRcvRepForGenTch (ActLstClk + 86) -#define ActRcvRepForSWAUsr (ActLstClk + 87) -#define ActRcvRepForSWATch (ActLstClk + 88) -#define ActReqDelThrCrsUsr (ActLstClk + 89) -#define ActReqDelThrCrsTch (ActLstClk + 90) -#define ActReqDelThrDegUsr (ActLstClk + 91) -#define ActReqDelThrDegTch (ActLstClk + 92) -#define ActReqDelThrCtrUsr (ActLstClk + 93) -#define ActReqDelThrCtrTch (ActLstClk + 94) -#define ActReqDelThrInsUsr (ActLstClk + 95) -#define ActReqDelThrInsTch (ActLstClk + 96) -#define ActReqDelThrGenUsr (ActLstClk + 97) -#define ActReqDelThrGenTch (ActLstClk + 98) -#define ActReqDelThrSWAUsr (ActLstClk + 99) -#define ActReqDelThrSWATch (ActLstClk + 100) -#define ActDelThrForCrsUsr (ActLstClk + 101) -#define ActDelThrForCrsTch (ActLstClk + 102) -#define ActDelThrForDegUsr (ActLstClk + 103) -#define ActDelThrForDegTch (ActLstClk + 104) -#define ActDelThrForCtrUsr (ActLstClk + 105) -#define ActDelThrForCtrTch (ActLstClk + 106) -#define ActDelThrForInsUsr (ActLstClk + 107) -#define ActDelThrForInsTch (ActLstClk + 108) -#define ActDelThrForGenUsr (ActLstClk + 109) -#define ActDelThrForGenTch (ActLstClk + 110) -#define ActDelThrForSWAUsr (ActLstClk + 111) -#define ActDelThrForSWATch (ActLstClk + 112) -#define ActCutThrForCrsUsr (ActLstClk + 113) -#define ActCutThrForCrsTch (ActLstClk + 114) -#define ActCutThrForDegUsr (ActLstClk + 115) -#define ActCutThrForDegTch (ActLstClk + 116) -#define ActCutThrForCtrUsr (ActLstClk + 117) -#define ActCutThrForCtrTch (ActLstClk + 118) -#define ActCutThrForInsUsr (ActLstClk + 119) -#define ActCutThrForInsTch (ActLstClk + 120) -#define ActCutThrForGenUsr (ActLstClk + 121) -#define ActCutThrForGenTch (ActLstClk + 122) -#define ActCutThrForSWAUsr (ActLstClk + 123) -#define ActCutThrForSWATch (ActLstClk + 124) -#define ActPasThrForCrsUsr (ActLstClk + 125) -#define ActPasThrForCrsTch (ActLstClk + 126) -#define ActPasThrForDegUsr (ActLstClk + 127) -#define ActPasThrForDegTch (ActLstClk + 128) -#define ActPasThrForCtrUsr (ActLstClk + 129) -#define ActPasThrForCtrTch (ActLstClk + 130) -#define ActPasThrForInsUsr (ActLstClk + 131) -#define ActPasThrForInsTch (ActLstClk + 132) -#define ActPasThrForGenUsr (ActLstClk + 133) -#define ActPasThrForGenTch (ActLstClk + 134) -#define ActPasThrForSWAUsr (ActLstClk + 135) -#define ActPasThrForSWATch (ActLstClk + 136) -#define ActDelPstForCrsUsr (ActLstClk + 137) -#define ActDelPstForCrsTch (ActLstClk + 138) -#define ActDelPstForDegUsr (ActLstClk + 139) -#define ActDelPstForDegTch (ActLstClk + 140) -#define ActDelPstForCtrUsr (ActLstClk + 141) -#define ActDelPstForCtrTch (ActLstClk + 142) -#define ActDelPstForInsUsr (ActLstClk + 143) -#define ActDelPstForInsTch (ActLstClk + 144) -#define ActDelPstForGenUsr (ActLstClk + 145) -#define ActDelPstForGenTch (ActLstClk + 146) -#define ActDelPstForSWAUsr (ActLstClk + 147) -#define ActDelPstForSWATch (ActLstClk + 148) -#define ActEnbPstForCrsUsr (ActLstClk + 149) -#define ActEnbPstForCrsTch (ActLstClk + 150) -#define ActEnbPstForDegUsr (ActLstClk + 151) -#define ActEnbPstForDegTch (ActLstClk + 152) -#define ActEnbPstForCtrUsr (ActLstClk + 153) -#define ActEnbPstForCtrTch (ActLstClk + 154) -#define ActEnbPstForInsUsr (ActLstClk + 155) -#define ActEnbPstForInsTch (ActLstClk + 156) -#define ActEnbPstForGenUsr (ActLstClk + 157) -#define ActEnbPstForGenTch (ActLstClk + 158) -#define ActEnbPstForSWAUsr (ActLstClk + 159) -#define ActEnbPstForSWATch (ActLstClk + 160) -#define ActDisPstForCrsUsr (ActLstClk + 161) -#define ActDisPstForCrsTch (ActLstClk + 162) -#define ActDisPstForDegUsr (ActLstClk + 163) -#define ActDisPstForDegTch (ActLstClk + 164) -#define ActDisPstForCtrUsr (ActLstClk + 165) -#define ActDisPstForCtrTch (ActLstClk + 166) -#define ActDisPstForInsUsr (ActLstClk + 167) -#define ActDisPstForInsTch (ActLstClk + 168) -#define ActDisPstForGenUsr (ActLstClk + 169) -#define ActDisPstForGenTch (ActLstClk + 170) -#define ActDisPstForSWAUsr (ActLstClk + 171) -#define ActDisPstForSWATch (ActLstClk + 172) +#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 + 173) +#define ActCht (ActLstClk + 172) /*****************************************************************************/ /******************************* Messages tab ********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 358429fb..794b2015 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -199,13 +199,17 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.138 (2017-02-17)" +#define Log_PLATFORM_VERSION "SWAD 16.139 (2017-02-17)" #define CSS_FILE "swad16.136.css" #define JS_FILE "swad16.123.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.139: Feb 17, 2017 Fixed bugs showing my public profile. (? lines) + 1 change necessary in database: +DELETE FROM actions WHERE ActCod='1637'; + Version 16.138: Feb 17, 2017 On right column show only users to follow with visible photo. (212873 lines) Version 16.137: Feb 17, 2017 Link to view my public profile. (212808 lines) 1 change necessary in database: diff --git a/swad_parameter.c b/swad_parameter.c index e10061ec..1ca81993 100644 --- a/swad_parameter.c +++ b/swad_parameter.c @@ -692,7 +692,10 @@ void Par_GetMainParameters (void) // and to refresh old publishings in user's timeline // If user does not exist ==> UsrCod = -1 Gbl.Usrs.Other.UsrDat.UsrCod = Nck_GetUsrCodFromNickname (Gbl.Usrs.Other.UsrDat.Nickname); - Gbl.Action.Act = ActSeeOthPubPrf; // Set default action if no other is specified + if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) + Gbl.Action.Act = ActSeeOthPubPrf; // Set default action if no other is specified + else + Gbl.Usrs.Other.UsrDat.UsrCod = -1L; } } else if (Par_GetParToText ("agd",Nickname,Nck_MAX_BYTES_NICKNAME_FROM_FORM)) diff --git a/swad_photo.c b/swad_photo.c index f36b9113..a983fb1c 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -1121,32 +1121,20 @@ void Pho_ShowUsrPhoto (const struct UsrData *UsrDat,const char *PhotoURL, Zoom == Pho_ZOOM && // Make zoom Act_Actions[Gbl.Action.Act].BrowserWindow == Act_THIS_WINDOW; // Only in main window char IdCaption[Act_MAX_LENGTH_ID]; - bool ItsMe = (Gbl.Usrs.Me.Logged && - UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); /***** Start form to go to public profile *****/ if (PutLinkToPublicProfile) { if (FormUnique) { - if (ItsMe) - Act_FormStartUnique (ActSeeMyPubPrf); - else - { - Act_FormStartUnique (ActSeeOthPubPrf); - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - } - Act_LinkFormSubmitUnique (NULL,NULL); - } + Act_FormStartUnique (ActSeeOthPubPrf); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); + Act_LinkFormSubmitUnique (NULL,NULL); + } else { - if (ItsMe) - Act_FormStart (ActSeeMyPubPrf); - else - { - Act_FormStart (ActSeeOthPubPrf); - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - } + Act_FormStart (ActSeeOthPubPrf); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Act_LinkFormSubmit (NULL,NULL,NULL); } } diff --git a/swad_profile.c b/swad_profile.c index cf10a885..36bf0934 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -73,6 +73,8 @@ extern struct Globals Gbl; static void Prf_RequestUserProfileWithDefaultNickname (const char *DefaultNickname); +static void Prf_ShowUserProfileAndTimeline (void); + static void Prf_PutLinkToUpdateAction (Act_Action_t Action,const char *EncryptedUsrCod); static unsigned long Prf_GetRankingFigure (long UsrCod,const char *FieldName); @@ -131,7 +133,8 @@ void Prf_PutLinkMyPublicProfile (void) { extern const char *Txt_My_public_profile; - Lay_PutContextualLink (ActSeeMyPubPrf,NULL, + Lay_PutContextualLink (ActSeeOthPubPrf, + Usr_PutParamMyUsrCodEncrypted, "usr64x64.gif", Txt_My_public_profile,Txt_My_public_profile, NULL); @@ -207,19 +210,6 @@ static void Prf_RequestUserProfileWithDefaultNickname (const char *DefaultNickna Act_FormEnd (); } -/*****************************************************************************/ -/************************** Show my public profile ***************************/ -/*****************************************************************************/ - -void Prf_ShowMyProfile (void) - { - extern const char *Txt_User_not_found_or_you_do_not_have_permission_; - - if (!Prf_ShowUserProfile (&Gbl.Usrs.Me.UsrDat)) - /* Show error message */ - Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); - } - /*****************************************************************************/ /******************** Get user and show a user's profile *********************/ /*****************************************************************************/ @@ -227,46 +217,56 @@ void Prf_ShowMyProfile (void) void Prf_GetUsrDatAndShowUserProfile (void) { - extern const char *Txt_User_not_found_or_you_do_not_have_permission_; - bool Error; - /***** Get user's data *****/ if (Gbl.Usrs.Other.UsrDat.UsrCod <= 0) Usr_GetParamOtherUsrCodEncryptedAndGetListIDs (); - Error = !Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat); /***** Show profile and timeline *****/ - if (!Error) + if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat)) /* Show profile */ - Error = !Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); - - if (Error) - { - /* Show error message */ - Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); - - /* Request nickname again */ - Prf_RequestUserProfileWithDefaultNickname (""); - } - else if (Gbl.Usrs.Me.Logged) // Timeline visible only by logged users - { - /* Start section */ - fprintf (Gbl.F.Out,"
"); - - /* Show public social activity (timeline) of this user */ - Soc_ShowTimelineUsr (); - - /* End section */ - fprintf (Gbl.F.Out,"
"); - } + Prf_ShowUserProfileAndTimeline (); /***** If it's not me, mark possible notification as seen *****/ - if (Gbl.Usrs.Other.UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) + if (Gbl.Usrs.Other.UsrDat.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod) // Not me Ntf_MarkNotifAsSeen (Ntf_EVENT_FOLLOWER, Gbl.Usrs.Other.UsrDat.UsrCod,-1L, Gbl.Usrs.Me.UsrDat.UsrCod); } +/*****************************************************************************/ +/************* Show a user's profile followed by his/her timeline ************/ +/*****************************************************************************/ + +static void Prf_ShowUserProfileAndTimeline (void) + { + extern const char *Txt_User_not_found_or_you_do_not_have_permission_; + + /***** Show profile *****/ + if (Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) + { + if (Gbl.Usrs.Me.Logged) // Timeline visible only by logged users + { + /***** Show timeline *****/ + /* Start section */ + fprintf (Gbl.F.Out,"
"); + + /* Show public social activity (timeline) of this user */ + Soc_ShowTimelineUsr (); + + /* End section */ + fprintf (Gbl.F.Out,"
"); + } + } + else + { + /* Show error message */ + Lay_ShowAlert (Lay_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + + /* Request nickname */ + Prf_RequestUserProfileWithDefaultNickname (""); + } + } + /*****************************************************************************/ /*************************** Show a user's profile ***************************/ /*****************************************************************************/ @@ -1524,8 +1524,6 @@ void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank) bool ShowPhoto; char PhotoURL[PATH_MAX + 1]; bool Visible = Pri_ShowingIsAllowed (UsrDat->ProfileVisibility,UsrDat); - bool ItsMe = (Gbl.Usrs.Me.Logged && - UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); fprintf (Gbl.F.Out,"" @@ -1554,13 +1552,8 @@ void Prf_ShowUsrInRanking (struct UsrData *UsrDat,unsigned Rank) /***** Put form to go to public profile *****/ if (Visible) { - if (ItsMe) - Act_FormStart (ActSeeMyPubPrf); - else - { - Act_FormStart (ActSeeOthPubPrf); - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - } + Act_FormStart (ActSeeOthPubPrf); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); Act_LinkFormSubmit (Txt_Another_user_s_profile,"DAT_SMALL",NULL); Usr_RestrictLengthAndWriteName (UsrDat,8); fprintf (Gbl.F.Out,""); diff --git a/swad_profile.h b/swad_profile.h index 45582cec..62e0b045 100644 --- a/swad_profile.h +++ b/swad_profile.h @@ -55,7 +55,6 @@ char *Prf_GetURLPublicProfile (char *URL,const char *NicknameWithoutArroba); void Prf_PutLinkMyPublicProfile (void); void Prf_PutLinkRequestAnotherUserProfile (void); void Prf_RequestUserProfile (void); -void Prf_ShowMyProfile (void); void Prf_GetUsrDatAndShowUserProfile (void); bool Prf_ShowUserProfile (struct UsrData *UsrDat); diff --git a/swad_record.c b/swad_record.c index 2e8852cc..7b6d954d 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2362,23 +2362,18 @@ static void Rec_PutIconsCommands (void) fprintf (Gbl.F.Out,"
"); if (ItsMe) - { - /***** Buttons to edit my record card and to view my profile *****/ + /***** Button to edit my record card *****/ Lay_PutContextualLink (ActReqEdiRecCom,NULL, "edit64x64.png", Txt_Edit_my_personal_data,NULL, NULL); - Lay_PutContextualLink (ActSeeMyPubPrf,NULL, - "usr64x64.gif", - Txt_My_public_profile,NULL, - NULL); - } - else if (ICanViewUsrProfile) - /***** Button to view another user's profile *****/ + if (ICanViewUsrProfile) + /***** Button to view user's profile *****/ Lay_PutContextualLink (ActSeeOthPubPrf, Rec_PutParamUsrCodEncrypted, "usr64x64.gif", - Txt_Another_user_s_profile,NULL, + ItsMe ? Txt_My_public_profile : + Txt_Another_user_s_profile,NULL, NULL); /***** Button to view user's record card *****/ @@ -2637,17 +2632,11 @@ static void Rec_ShowNickname (struct UsrData *UsrDat,bool PutFormLinks) /* Put form to go to public profile */ ItsMe = (Gbl.Usrs.Me.Logged && UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); - if (ItsMe) - { - Act_FormStart (ActSeeMyPubPrf); - Act_LinkFormSubmit (Txt_My_public_profile,"REC_NICK",NULL); - } - else - { - Act_FormStart (ActSeeOthPubPrf); - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - Act_LinkFormSubmit (Txt_Another_user_s_profile,"REC_NICK",NULL); - } + Act_FormStart (ActSeeOthPubPrf); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); + Act_LinkFormSubmit (ItsMe ? Txt_My_public_profile : + Txt_Another_user_s_profile, + "REC_NICK",NULL); } fprintf (Gbl.F.Out,"@%s",UsrDat->Nickname); if (PutFormLinks) diff --git a/swad_social.c b/swad_social.c index 74faee30..a6207d36 100644 --- a/swad_social.c +++ b/swad_social.c @@ -347,7 +347,9 @@ static void Soc_ShowTimelineGblHighlightingNot (long NotCod) if (!Fol_GetNumFollowing (Gbl.Usrs.Me.UsrDat.UsrCod)) { /***** Put link to show users to follow *****/ + fprintf (Gbl.F.Out,"
"); Fol_PutLinkWhoToFollow (); + fprintf (Gbl.F.Out,"
"); /***** Show warning if I do not follow anyone *****/ Lay_ShowAlert (Lay_WARNING,Txt_You_dont_follow_any_user); @@ -1374,38 +1376,24 @@ static void Soc_WriteTopMessage (Soc_TopMessage_t TopMessage,long UsrCod) struct UsrData UsrDat; bool ItsMe = (Gbl.Usrs.Me.Logged && UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); - bool UsrOK; if (TopMessage != Soc_TOP_MESSAGE_NONE) { - if (ItsMe) - UsrOK = true; - else - { - /***** Initialize structure with user's data *****/ - Usr_UsrDataConstructor (&UsrDat); + /***** Initialize structure with user's data *****/ + Usr_UsrDataConstructor (&UsrDat); - /***** Get user's data *****/ - UsrDat.UsrCod = UsrCod; - UsrOK = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); // Really we only need EncryptedUsrCod and FullName - } - - if (UsrOK) + /***** Get user's data *****/ + UsrDat.UsrCod = UsrCod; + if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat)) // Really we only need EncryptedUsrCod and FullName { fprintf (Gbl.F.Out,"
"); /***** Show user's name inside form to go to user's public profile *****/ - if (ItsMe) - { - Act_FormStartUnique (ActSeeMyPubPrf); - Act_LinkFormSubmitUnique (Txt_My_public_profile,"SOCIAL_TOP_PUBLISHER"); - } - else - { - Act_FormStartUnique (ActSeeOthPubPrf); - Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); - Act_LinkFormSubmitUnique (Txt_Another_user_s_profile,"SOCIAL_TOP_PUBLISHER"); - } + Act_FormStartUnique (ActSeeOthPubPrf); + Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod); + Act_LinkFormSubmitUnique (ItsMe ? Txt_My_public_profile : + Txt_Another_user_s_profile, + "SOCIAL_TOP_PUBLISHER"); Str_LimitLengthHTMLStr (UsrDat.FullName,40); fprintf (Gbl.F.Out,"%s",UsrDat.FullName); Act_FormEnd (); @@ -1415,9 +1403,8 @@ static void Soc_WriteTopMessage (Soc_TopMessage_t TopMessage,long UsrCod) Txt_SOCIAL_NOTE_TOP_MESSAGES[TopMessage]); } - if (!ItsMe) - /***** Free memory used for user's data *****/ - Usr_UsrDataDestructor (&UsrDat); + /***** Free memory used for user's data *****/ + Usr_UsrDataDestructor (&UsrDat); } } @@ -1436,33 +1423,21 @@ static void Soc_WriteAuthorNote (struct UsrData *UsrDat) fprintf (Gbl.F.Out,"
"); /***** Show user's name inside form to go to user's public profile *****/ - if (ItsMe) - { - Act_FormStartUnique (ActSeeMyPubPrf); - Act_LinkFormSubmitUnique (Txt_My_public_profile,"DAT_N_BOLD"); - } - else - { - Act_FormStartUnique (ActSeeOthPubPrf); - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - Act_LinkFormSubmitUnique (Txt_Another_user_s_profile,"DAT_N_BOLD"); - } + Act_FormStartUnique (ActSeeOthPubPrf); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); + Act_LinkFormSubmitUnique (ItsMe ? Txt_My_public_profile : + Txt_Another_user_s_profile, + "DAT_N_BOLD"); Str_LimitLengthHTMLStr (UsrDat->FullName,16); fprintf (Gbl.F.Out,"%s",UsrDat->FullName); Act_FormEnd (); /***** Show user's nickname inside form to go to user's public profile *****/ - if (ItsMe) - { - Act_FormStartUnique (ActSeeMyPubPrf); - Act_LinkFormSubmitUnique (Txt_My_public_profile,"DAT_N_BOLD"); - } - else - { - Act_FormStartUnique (ActSeeOthPubPrf); - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - Act_LinkFormSubmitUnique (Txt_Another_user_s_profile,"DAT_LIGHT"); - } + Act_FormStartUnique (ActSeeOthPubPrf); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); + Act_LinkFormSubmitUnique (ItsMe ? Txt_My_public_profile : + Txt_Another_user_s_profile, + "DAT_LIGHT"); fprintf (Gbl.F.Out," @%s",UsrDat->Nickname); Act_FormEnd (); @@ -2500,33 +2475,24 @@ static void Soc_WriteAuthorComment (struct UsrData *UsrDat) fprintf (Gbl.F.Out,"
"); /***** Show user's name inside form to go to user's public profile *****/ - if (ItsMe) - { - Act_FormStartUnique (ActSeeMyPubPrf); - Act_LinkFormSubmitUnique (Txt_My_public_profile,"DAT_N_BOLD"); - } - else - { - Act_FormStartUnique (ActSeeOthPubPrf); - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - Act_LinkFormSubmitUnique (Txt_Another_user_s_profile,"DAT_BOLD"); - } + Act_FormStartUnique (ActSeeOthPubPrf); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); + Act_LinkFormSubmitUnique (ItsMe ? Txt_My_public_profile : + Txt_Another_user_s_profile, + "DAT_BOLD"); Str_LimitLengthHTMLStr (UsrDat->FullName,12); fprintf (Gbl.F.Out,"%s",UsrDat->FullName); Act_FormEnd (); /***** Show user's nickname inside form to go to user's public profile *****/ - if (ItsMe) - { - Act_FormStartUnique (ActSeeMyPubPrf); - Act_LinkFormSubmitUnique (Txt_My_public_profile,"DAT_LIGHT"); - } - else - { - Act_FormStartUnique (ActSeeOthPubPrf); - Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); - Act_LinkFormSubmitUnique (Txt_Another_user_s_profile,"DAT_LIGHT"); - } + Act_FormStartUnique (ActSeeOthPubPrf); + Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); + Act_LinkFormSubmitUnique (ItsMe ? Txt_My_public_profile : + Txt_Another_user_s_profile, + "DAT_LIGHT"); + Str_LimitLengthHTMLStr (UsrDat->FullName,12); + fprintf (Gbl.F.Out,"%s",UsrDat->FullName); + Act_FormEnd (); fprintf (Gbl.F.Out," @%s",UsrDat->Nickname); Act_FormEnd (); diff --git a/swad_user.c b/swad_user.c index 5239a352..abbf28ae 100644 --- a/swad_user.c +++ b/swad_user.c @@ -2426,6 +2426,11 @@ unsigned Usr_GetParamOtherUsrIDNickOrEMailAndGetUsrCods (struct ListUsrCods *Lis /********* Put hidden parameter encrypted user's code of other user **********/ /*****************************************************************************/ +void Usr_PutParamMyUsrCodEncrypted (void) + { + Usr_PutParamUsrCodEncrypted (Gbl.Usrs.Me.UsrDat.EncryptedUsrCod); + } + void Usr_PutParamOtherUsrCodEncrypted (void) { Usr_PutParamUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod); diff --git a/swad_user.h b/swad_user.h index e3767d0a..5050192a 100644 --- a/swad_user.h +++ b/swad_user.h @@ -300,6 +300,7 @@ void Usr_PutFormLogOut (void); void Usr_GetParamUsrIdLogin (void); unsigned Usr_GetParamOtherUsrIDNickOrEMailAndGetUsrCods (struct ListUsrCods *ListUsrCods); +void Usr_PutParamMyUsrCodEncrypted (void); void Usr_PutParamOtherUsrCodEncrypted (void); void Usr_PutParamUsrCodEncrypted (const char EncryptedUsrCod[Cry_LENGTH_ENCRYPTED_STR_SHA256_BASE64 + 1]); void Usr_GetParamOtherUsrCodEncrypted (struct UsrData *UsrDat);