Version 15.121

This commit is contained in:
Antonio Cañas Vargas 2016-01-19 12:54:27 +01:00
parent 08901a76bf
commit 03c89d4dd8
8 changed files with 491 additions and 209 deletions

View File

@ -923,6 +923,17 @@ CREATE TABLE IF NOT EXISTS social_comments (
UNIQUE INDEX(ComCod),
FULLTEXT(Content)) ENGINE = MYISAM;
--
-- Table social_comments_fav: stores users who marked social comments as favourite
--
CREATE TABLE IF NOT EXISTS social_comments_fav (
FavCod BIGINT AUTO_INCREMENT,
ComCod BIGINT NOT NULL,
UsrCod INT NOT NULL,
TimeFav DATETIME NOT NULL,
UNIQUE INDEX(FavCod),
UNIQUE INDEX(ComCod,UsrCod),
INDEX(UsrCod));
--
-- Table social_notes: stores social notes
--
CREATE TABLE IF NOT EXISTS social_notes (

View File

@ -1010,7 +1010,9 @@ Social:
843. ActShaSocNotGbl Share a social note in the timeline (global)
844. ActUnsSocNotGbl Unshare a previously shared social note in the timeline (global)
NEW 843. ActFavSocNotGbl Favourite a social note in the timeline (global)
NEW 844. ActUnfSocNotGbl Unfavourite a previously shared social note in the timeline (global)
NEW 844. ActUnfSocNotGbl Unfavourite a previously favourited social note in the timeline (global)
NEW 843. ActFavSocComGbl Favourite a social comment in the timeline (global)
NEW 844. ActUnfSocComGbl Unfavourite a previously favourited social comment in the timeline (global)
845. ActReqRemSocPubGbl Request the removal of a social publishing in the timeline (global)
846. ActRemSocPubGbl Remove a social publishing in the timeline (global)
847. ActReqRemSocComGbl Request the removal of a comment in a social note (global)
@ -1021,7 +1023,9 @@ NEW 844. ActUnfSocNotGbl Unfavourite a previously shared social note in the tim
851. ActShaSocNotUsr Share a social note in the timeline (user)
852. ActUnsSocNotUsr Unshare a previously shared social note in the timeline (user)
NEW 851. ActFavSocNotUsr Favourite a social note in the timeline (user)
NEW 852. ActUnfSocNotUsr Unfavourite a previously shared social note in the timeline (user)
NEW 852. ActUnfSocNotUsr Unfavourite a previously favourited social note in the timeline (user)
NEW 851. ActFavSocComUsr Favourite a social comment in the timeline (user)
NEW 852. ActUnfSocComUsr Unfavourite a previously favourited social comment in the timeline (user)
853. ActReqRemSocPubUsr Request the removal of a social publishing in the timeline (user)
854. ActRemSocPubUsr Remove a social publishing in the timeline (user)
855. ActReqRemSocComUsr Request the removal of a comment in a social note (user)
@ -2343,6 +2347,8 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActUnsSocNotGbl */{1496,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_UnshareSocialNoteGbl ,NULL},
/* ActFavSocNotGbl */{1512,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_FavSocialNoteGbl ,NULL},
/* ActUnfSocNotGbl */{1513,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_UnfavSocialNoteGbl ,NULL},
/* ActFavSocComGbl */{1516,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_FavSocialCommentGbl ,NULL},
/* ActUnfSocComGbl */{1517,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_UnfavSocialCommentGbl ,NULL},
/* ActReqRemSocPubGbl*/{1494,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemSocialNoteGbl ,NULL},
/* ActRemSocPubGbl */{1493,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialNoteGbl ,NULL},
/* ActReqRemSocComGbl*/{1505,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemSocialComGbl ,NULL},
@ -2352,8 +2358,10 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActRcvSocComUsr */{1504,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_ReceiveCommentUsr ,NULL},
/* ActShaSocNotUsr */{1499,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_ShareSocialNoteUsr ,NULL},
/* ActUnsSocNotUsr */{1500,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_UnshareSocialNoteUsr ,NULL},
/* ActShaSocNotUsr */{1514,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_FavSocialNoteUsr ,NULL},
/* ActUnsSocNotUsr */{1515,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_UnfavSocialNoteUsr ,NULL},
/* ActFavSocNotUsr */{1514,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_FavSocialNoteUsr ,NULL},
/* ActUnfSocNotUsr */{1515,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_UnfavSocialNoteUsr ,NULL},
/* ActFavSocComUsr */{1518,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_FavSocialCommentUsr ,NULL},
/* ActUnfSocComUsr */{1519,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_UnfavSocialCommentUsr ,NULL},
/* ActReqRemSocPubUsr*/{1501,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemSocialNoteUsr ,NULL},
/* ActRemSocPubUsr */{1502,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialNoteUsr ,NULL},
/* ActReqRemSocComGbl*/{1506,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemSocialComUsr ,NULL},
@ -4221,6 +4229,10 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
ActUnfSocNotGbl, // #1513
ActFavSocNotUsr, // #1514
ActUnfSocNotUsr, // #1515
ActFavSocComGbl, // #1516
ActUnfSocComGbl, // #1517
ActFavSocComUsr, // #1518
ActUnfSocComUsr, // #1519
};
/*****************************************************************************/

View File

@ -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+167+36+27+82)
#define Act_NUM_ACTIONS (1+9+52+15+90+72+67+205+183+143+171+36+27+82)
#define Act_MAX_ACTION_COD 1515
#define Act_MAX_ACTION_COD 1519
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 20
@ -1053,168 +1053,172 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
#define ActUnsSocNotGbl (ActLstClk+ 8)
#define ActFavSocNotGbl (ActLstClk+ 9)
#define ActUnfSocNotGbl (ActLstClk+ 10)
#define ActReqRemSocPubGbl (ActLstClk+ 11)
#define ActRemSocPubGbl (ActLstClk+ 12)
#define ActReqRemSocComGbl (ActLstClk+ 13)
#define ActRemSocComGbl (ActLstClk+ 14)
#define ActFavSocComGbl (ActLstClk+ 11)
#define ActUnfSocComGbl (ActLstClk+ 12)
#define ActReqRemSocPubGbl (ActLstClk+ 13)
#define ActRemSocPubGbl (ActLstClk+ 14)
#define ActReqRemSocComGbl (ActLstClk+ 15)
#define ActRemSocComGbl (ActLstClk+ 16)
#define ActRcvSocPstUsr (ActLstClk+ 15)
#define ActRcvSocComUsr (ActLstClk+ 16)
#define ActShaSocNotUsr (ActLstClk+ 17)
#define ActUnsSocNotUsr (ActLstClk+ 18)
#define ActFavSocNotUsr (ActLstClk+ 19)
#define ActUnfSocNotUsr (ActLstClk+ 20)
#define ActReqRemSocPubUsr (ActLstClk+ 21)
#define ActRemSocPubUsr (ActLstClk+ 22)
#define ActReqRemSocComUsr (ActLstClk+ 23)
#define ActRemSocComUsr (ActLstClk+ 24)
#define ActRcvSocPstUsr (ActLstClk+ 17)
#define ActRcvSocComUsr (ActLstClk+ 18)
#define ActShaSocNotUsr (ActLstClk+ 19)
#define ActUnsSocNotUsr (ActLstClk+ 20)
#define ActFavSocNotUsr (ActLstClk+ 21)
#define ActUnfSocNotUsr (ActLstClk+ 22)
#define ActFavSocComUsr (ActLstClk+ 23)
#define ActUnfSocComUsr (ActLstClk+ 24)
#define ActReqRemSocPubUsr (ActLstClk+ 25)
#define ActRemSocPubUsr (ActLstClk+ 26)
#define ActReqRemSocComUsr (ActLstClk+ 27)
#define ActRemSocComUsr (ActLstClk+ 28)
#define ActSeePubPrf (ActLstClk+ 25)
#define ActCal1stClkTim (ActLstClk+ 26)
#define ActCalNumClk (ActLstClk+ 27)
#define ActCalNumFilVie (ActLstClk+ 28)
#define ActCalNumForPst (ActLstClk+ 29)
#define ActCalNumMsgSnt (ActLstClk+ 30)
#define ActSeePubPrf (ActLstClk+ 29)
#define ActCal1stClkTim (ActLstClk+ 30)
#define ActCalNumClk (ActLstClk+ 31)
#define ActCalNumFilVie (ActLstClk+ 32)
#define ActCalNumForPst (ActLstClk+ 33)
#define ActCalNumMsgSnt (ActLstClk+ 34)
#define ActFolUsr (ActLstClk+ 31)
#define ActUnfUsr (ActLstClk+ 32)
#define ActSeeFlg (ActLstClk+ 33)
#define ActSeeFlr (ActLstClk+ 34)
#define ActFolUsr (ActLstClk+ 35)
#define ActUnfUsr (ActLstClk+ 36)
#define ActSeeFlg (ActLstClk+ 37)
#define ActSeeFlr (ActLstClk+ 38)
#define ActSeeForCrsUsr (ActLstClk+ 35)
#define ActSeeForCrsTch (ActLstClk+ 36)
#define ActSeeForDegUsr (ActLstClk+ 37)
#define ActSeeForDegTch (ActLstClk+ 38)
#define ActSeeForCtrUsr (ActLstClk+ 39)
#define ActSeeForCtrTch (ActLstClk+ 40)
#define ActSeeForInsUsr (ActLstClk+ 41)
#define ActSeeForInsTch (ActLstClk+ 42)
#define ActSeeForGenUsr (ActLstClk+ 43)
#define ActSeeForGenTch (ActLstClk+ 44)
#define ActSeeForSWAUsr (ActLstClk+ 45)
#define ActSeeForSWATch (ActLstClk+ 46)
#define ActSeePstForCrsUsr (ActLstClk+ 47)
#define ActSeePstForCrsTch (ActLstClk+ 48)
#define ActSeePstForDegUsr (ActLstClk+ 49)
#define ActSeePstForDegTch (ActLstClk+ 50)
#define ActSeePstForCtrUsr (ActLstClk+ 51)
#define ActSeePstForCtrTch (ActLstClk+ 52)
#define ActSeePstForInsUsr (ActLstClk+ 53)
#define ActSeePstForInsTch (ActLstClk+ 54)
#define ActSeePstForGenUsr (ActLstClk+ 55)
#define ActSeePstForGenTch (ActLstClk+ 56)
#define ActSeePstForSWAUsr (ActLstClk+ 57)
#define ActSeePstForSWATch (ActLstClk+ 58)
#define ActRcvThrForCrsUsr (ActLstClk+ 59)
#define ActRcvThrForCrsTch (ActLstClk+ 60)
#define ActRcvThrForDegUsr (ActLstClk+ 61)
#define ActRcvThrForDegTch (ActLstClk+ 62)
#define ActRcvThrForCtrUsr (ActLstClk+ 63)
#define ActRcvThrForCtrTch (ActLstClk+ 64)
#define ActRcvThrForInsUsr (ActLstClk+ 65)
#define ActRcvThrForInsTch (ActLstClk+ 66)
#define ActRcvThrForGenUsr (ActLstClk+ 67)
#define ActRcvThrForGenTch (ActLstClk+ 68)
#define ActRcvThrForSWAUsr (ActLstClk+ 69)
#define ActRcvThrForSWATch (ActLstClk+ 70)
#define ActRcvRepForCrsUsr (ActLstClk+ 71)
#define ActRcvRepForCrsTch (ActLstClk+ 72)
#define ActRcvRepForDegUsr (ActLstClk+ 73)
#define ActRcvRepForDegTch (ActLstClk+ 74)
#define ActRcvRepForCtrUsr (ActLstClk+ 75)
#define ActRcvRepForCtrTch (ActLstClk+ 76)
#define ActRcvRepForInsUsr (ActLstClk+ 77)
#define ActRcvRepForInsTch (ActLstClk+ 78)
#define ActRcvRepForGenUsr (ActLstClk+ 79)
#define ActRcvRepForGenTch (ActLstClk+ 80)
#define ActRcvRepForSWAUsr (ActLstClk+ 81)
#define ActRcvRepForSWATch (ActLstClk+ 82)
#define ActReqDelThrCrsUsr (ActLstClk+ 83)
#define ActReqDelThrCrsTch (ActLstClk+ 84)
#define ActReqDelThrDegUsr (ActLstClk+ 85)
#define ActReqDelThrDegTch (ActLstClk+ 86)
#define ActReqDelThrCtrUsr (ActLstClk+ 87)
#define ActReqDelThrCtrTch (ActLstClk+ 88)
#define ActReqDelThrInsUsr (ActLstClk+ 89)
#define ActReqDelThrInsTch (ActLstClk+ 90)
#define ActReqDelThrGenUsr (ActLstClk+ 91)
#define ActReqDelThrGenTch (ActLstClk+ 92)
#define ActReqDelThrSWAUsr (ActLstClk+ 93)
#define ActReqDelThrSWATch (ActLstClk+ 94)
#define ActDelThrForCrsUsr (ActLstClk+ 95)
#define ActDelThrForCrsTch (ActLstClk+ 96)
#define ActDelThrForDegUsr (ActLstClk+ 97)
#define ActDelThrForDegTch (ActLstClk+ 98)
#define ActDelThrForCtrUsr (ActLstClk+ 99)
#define ActDelThrForCtrTch (ActLstClk+100)
#define ActDelThrForInsUsr (ActLstClk+101)
#define ActDelThrForInsTch (ActLstClk+102)
#define ActDelThrForGenUsr (ActLstClk+103)
#define ActDelThrForGenTch (ActLstClk+104)
#define ActDelThrForSWAUsr (ActLstClk+105)
#define ActDelThrForSWATch (ActLstClk+106)
#define ActCutThrForCrsUsr (ActLstClk+107)
#define ActCutThrForCrsTch (ActLstClk+108)
#define ActCutThrForDegUsr (ActLstClk+109)
#define ActCutThrForDegTch (ActLstClk+110)
#define ActCutThrForCtrUsr (ActLstClk+111)
#define ActCutThrForCtrTch (ActLstClk+112)
#define ActCutThrForInsUsr (ActLstClk+113)
#define ActCutThrForInsTch (ActLstClk+114)
#define ActCutThrForGenUsr (ActLstClk+115)
#define ActCutThrForGenTch (ActLstClk+116)
#define ActCutThrForSWAUsr (ActLstClk+117)
#define ActCutThrForSWATch (ActLstClk+118)
#define ActPasThrForCrsUsr (ActLstClk+119)
#define ActPasThrForCrsTch (ActLstClk+120)
#define ActPasThrForDegUsr (ActLstClk+121)
#define ActPasThrForDegTch (ActLstClk+122)
#define ActPasThrForCtrUsr (ActLstClk+123)
#define ActPasThrForCtrTch (ActLstClk+124)
#define ActPasThrForInsUsr (ActLstClk+125)
#define ActPasThrForInsTch (ActLstClk+126)
#define ActPasThrForGenUsr (ActLstClk+127)
#define ActPasThrForGenTch (ActLstClk+128)
#define ActPasThrForSWAUsr (ActLstClk+129)
#define ActPasThrForSWATch (ActLstClk+130)
#define ActDelPstForCrsUsr (ActLstClk+131)
#define ActDelPstForCrsTch (ActLstClk+132)
#define ActDelPstForDegUsr (ActLstClk+133)
#define ActDelPstForDegTch (ActLstClk+134)
#define ActDelPstForCtrUsr (ActLstClk+135)
#define ActDelPstForCtrTch (ActLstClk+136)
#define ActDelPstForInsUsr (ActLstClk+137)
#define ActDelPstForInsTch (ActLstClk+138)
#define ActDelPstForGenUsr (ActLstClk+139)
#define ActDelPstForGenTch (ActLstClk+140)
#define ActDelPstForSWAUsr (ActLstClk+141)
#define ActDelPstForSWATch (ActLstClk+142)
#define ActEnbPstForCrsUsr (ActLstClk+143)
#define ActEnbPstForCrsTch (ActLstClk+144)
#define ActEnbPstForDegUsr (ActLstClk+145)
#define ActEnbPstForDegTch (ActLstClk+146)
#define ActEnbPstForCtrUsr (ActLstClk+147)
#define ActEnbPstForCtrTch (ActLstClk+148)
#define ActEnbPstForInsUsr (ActLstClk+149)
#define ActEnbPstForInsTch (ActLstClk+150)
#define ActEnbPstForGenUsr (ActLstClk+151)
#define ActEnbPstForGenTch (ActLstClk+152)
#define ActEnbPstForSWAUsr (ActLstClk+153)
#define ActEnbPstForSWATch (ActLstClk+154)
#define ActDisPstForCrsUsr (ActLstClk+155)
#define ActDisPstForCrsTch (ActLstClk+156)
#define ActDisPstForDegUsr (ActLstClk+157)
#define ActDisPstForDegTch (ActLstClk+158)
#define ActDisPstForCtrUsr (ActLstClk+159)
#define ActDisPstForCtrTch (ActLstClk+160)
#define ActDisPstForInsUsr (ActLstClk+161)
#define ActDisPstForInsTch (ActLstClk+162)
#define ActDisPstForGenUsr (ActLstClk+163)
#define ActDisPstForGenTch (ActLstClk+164)
#define ActDisPstForSWAUsr (ActLstClk+165)
#define ActDisPstForSWATch (ActLstClk+166)
#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 ActCht (ActLstClk+167)
#define ActCht (ActLstClk+171)
/*****************************************************************************/
/******************************* Messages tab ********************************/

View File

@ -117,6 +117,7 @@
// TODO: Go to forum post (or at least to forum thread) from social timeline and notifications?
// TODO: Width of column for data in notifications is too short
// TODO: Increment one second after each refresh in social timeline?
// TODO: Notifications of new followers should go to follower's profile
// TODO: Fav comments (remove favs when comment is removed)
@ -124,13 +125,17 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.120.5 (2016-01-19)"
#define Log_PLATFORM_VERSION "SWAD 15.121 (2016-01-19)"
#define CSS_FILE "swad15.120.3.css"
#define JS_FILE "swad15.118.4.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.121: Jan 19, 2016 Favs in social comments. Not finished. (193782 lines)
1 change necessary in database:
CREATE TABLE IF NOT EXISTS social_comments_fav (FavCod BIGINT AUTO_INCREMENT,ComCod BIGINT NOT NULL,UsrCod INT NOT NULL,TimeFav DATETIME NOT NULL,UNIQUE INDEX(FavCod),UNIQUE INDEX(ComCod,UsrCod),INDEX(UsrCod));
Version 15.120.5: Jan 19, 2016 Remove favs when a social note is removed.
Remove favs when a user is removed. (193544 lines)
Version 15.120.4: Jan 19, 2016 Changes in database table social_notes_fav. (193527 lines)

View File

@ -1957,6 +1957,28 @@ mysql> DESCRIBE social_comments;
"UNIQUE INDEX(ComCod),"
"FULLTEXT(Content)) ENGINE = MYISAM;");
/***** Table social_comments_fav *****/
/*
mysql> DESCRIBE social_comments_fav;
+---------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------+------+-----+---------+----------------+
| FavCod | bigint(20) | NO | PRI | NULL | auto_increment |
| ComCod | bigint(20) | NO | MUL | NULL | |
| UsrCod | int(11) | NO | MUL | NULL | |
| TimeFav | datetime | NO | | NULL | |
+---------+------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS social_comments_fav ("
"FavCod BIGINT AUTO_INCREMENT,"
"ComCod BIGINT NOT NULL,"
"UsrCod INT NOT NULL,"
"TimeFav DATETIME NOT NULL," // Not used. For future use
"UNIQUE INDEX(FavCod),"
"UNIQUE INDEX(ComCod,UsrCod),"
"INDEX(UsrCod))");
/***** Table social_notes *****/
/*
mysql> DESCRIBE social_notes;

View File

@ -617,6 +617,8 @@ static void Lay_WriteScriptInit (void)
Gbl.Action.Act == ActUnsSocNotGbl ||
Gbl.Action.Act == ActFavSocNotGbl ||
Gbl.Action.Act == ActUnfSocNotGbl ||
Gbl.Action.Act == ActFavSocComGbl ||
Gbl.Action.Act == ActUnfSocComGbl ||
Gbl.Action.Act == ActReqRemSocPubGbl ||
Gbl.Action.Act == ActRemSocPubGbl ||
Gbl.Action.Act == ActReqRemSocComGbl ||
@ -654,6 +656,8 @@ static void Lay_WriteScriptParamsAJAX (void)
Gbl.Action.Act == ActUnsSocNotGbl ||
Gbl.Action.Act == ActFavSocNotGbl ||
Gbl.Action.Act == ActUnfSocNotGbl ||
Gbl.Action.Act == ActFavSocComGbl ||
Gbl.Action.Act == ActUnfSocComGbl ||
Gbl.Action.Act == ActReqRemSocPubGbl ||
Gbl.Action.Act == ActRemSocPubGbl ||
Gbl.Action.Act == ActReqRemSocComGbl ||
@ -672,6 +676,8 @@ static void Lay_WriteScriptParamsAJAX (void)
Gbl.Action.Act == ActUnsSocNotUsr ||
Gbl.Action.Act == ActFavSocNotUsr ||
Gbl.Action.Act == ActUnfSocNotUsr ||
Gbl.Action.Act == ActFavSocComUsr ||
Gbl.Action.Act == ActUnfSocComUsr ||
Gbl.Action.Act == ActReqRemSocPubUsr ||
Gbl.Action.Act == ActRemSocPubUsr ||
Gbl.Action.Act == ActReqRemSocComUsr ||

View File

@ -199,6 +199,7 @@ struct SocialComment
long UsrCod;
long NotCod; // Note code
time_t DateTimeUTC;
unsigned NumFavs; // Number of times (users) this comment has been favourited
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
};
@ -270,7 +271,9 @@ static void Soc_WriteCommentsInSocialNote (const struct SocialNote *SocNot,
static void Soc_WriteSocialComment (struct SocialComment *SocCom,
bool ShowCommentAlone);
static void Soc_WriteAuthorComment (struct UsrData *UsrDat);
static void Soc_PutFormToRemoveComment (long ComCod);
static void Soc_PutFormToFavSocialComment (long ComCod);
static void Soc_PutDisabledIconShare (unsigned NumShared);
static void Soc_PutDisabledIconFav (unsigned NumFavs);
@ -292,10 +295,11 @@ static long Soc_ReceiveComment (void);
static long Soc_ShareSocialNote (void);
static long Soc_FavSocialNote (void);
static long Soc_FavSocialComment (void);
static long Soc_UnshareSocialNote (void);
static void Soc_UnshareASocialPublishingFromDB (struct SocialNote *SocNot);
static long Soc_UnfavSocialNote (void);
static long Soc_UnfavSocialComment (void);
static void Soc_RequestRemovalSocialNote (void);
static void Soc_RemoveSocialNote (void);
@ -305,8 +309,9 @@ static void Soc_RequestRemovalSocialComment (void);
static void Soc_RemoveSocialComment (void);
static void Soc_RemoveASocialCommentFromDB (struct SocialComment *SocCom);
static bool Soc_CheckIfNoteIsPublishedInTimelineByUsr (long NotCod,long UsrCod);
static bool Soc_CheckIfNoteIsFavouritedByUsr (long NotCod,long UsrCod);
static bool Soc_CheckIfNotIsPublishedInTimelineByUsr (long NotCod,long UsrCod);
static bool Soc_CheckIfNotIsFavouritedByUsr (long NotCod,long UsrCod);
static bool Soc_CheckIfComIsFavouritedByUsr (long ComCod,long UsrCod);
static void Soc_UpdateNumTimesANoteHasBeenShared (struct SocialNote *SocNot);
static void Soc_UpdateNumTimesANoteHasBeenFav (struct SocialNote *SocNot);
@ -1089,10 +1094,10 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
if (Gbl.Usrs.Me.Logged)
{
IAmTheAuthor = (UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAPublisherOfThisSocNot = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAFavouriterOfThisSocNot = Soc_CheckIfNoteIsFavouritedByUsr (SocNot->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAPublisherOfThisSocNot = Soc_CheckIfNotIsPublishedInTimelineByUsr (SocNot->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAFavouriterOfThisSocNot = Soc_CheckIfNotIsFavouritedByUsr (SocNot->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
/***** Left: write author's photo *****/
@ -2154,6 +2159,7 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom,
extern const char *Txt_Institution;
struct UsrData UsrDat;
bool IAmTheAuthor;
bool IAmAFavouriterOfThisSocCom;
bool ShowPhoto = false;
char PhotoURL[PATH_MAX+1];
@ -2184,6 +2190,8 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom,
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat);
IAmTheAuthor = (Gbl.Usrs.Me.Logged &&
UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAFavouriterOfThisSocCom = Soc_CheckIfComIsFavouritedByUsr (SocCom->ComCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
/***** Left: write author's photo *****/
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_COMMENT_PHOTO\">");
@ -2207,6 +2215,23 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom,
Msg_WriteMsgContent (SocCom->Content,Cns_MAX_BYTES_LONG_TEXT,true,false);
fprintf (Gbl.F.Out,"</div>");
/* Put icon to fav this social comment */
if (!IAmTheAuthor && !ShowCommentAlone)
Soc_PutFormToFavSocialComment (SocCom->ComCod);
/* Put icon to mark this social comment as favourite */
if (IAmTheAuthor) // I am the author
Soc_PutDisabledIconFav (SocCom->NumFavs);
else if (IAmAFavouriterOfThisSocCom) // I have favourited this social note
/* Put icon to unfav this publishing */
Soc_PutFormToUnfavSocialComment (SocCom->ComCod);
else // I am not the author and I am not a favouriter
/* Put icon to mark this social comment as favourite */
Soc_PutFormToFavSocialComment (SocCom->ComCod);
/* Show who have marked this social comment as favourite */
Soc_ShowUsrsWhoHaveMarkedSocialCommentAsFav (SocComt);
/* Put icon to remove this social comment */
if (IAmTheAuthor && !ShowCommentAlone)
Soc_PutFormToRemoveComment (SocCom->ComCod);
@ -2285,6 +2310,35 @@ static void Soc_PutFormToRemoveComment (long ComCod)
Act_FormEnd ();
}
/*****************************************************************************/
/***************** Form to mark a social comment as favourite ****************/
/*****************************************************************************/
// All forms in this function and nested functions must have unique identifiers
static void Soc_PutFormToFavSocialComment (long ComCod)
{
extern const char *Txt_Mark_as_favourite;
/***** Form to mark social comment as favourite *****/
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
{
Act_FormStartUniqueAnchor (ActFavSocComUsr,"timeline");
Usr_PutParamOtherUsrCodEncrypted ();
}
else
Act_FormStartUnique (ActFavSocComGbl);
Soc_PutHiddenParamComCod (ComCod);
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_ICON_SHARE_FAV ICON_HIGHLIGHT\">"
"<input type=\"image\""
" src=\"%s/fav64x64.png\""
" alt=\"%s\" title=\"%s\""
" class=\"ICON20x20\" />"
"</div>",
Gbl.Prefs.IconsURL,
Txt_Mark_as_favourite,Txt_Mark_as_favourite);
Act_FormEnd ();
}
/*****************************************************************************/
/*********************** Put disabled icon to share **************************/
/*****************************************************************************/
@ -2674,8 +2728,8 @@ static long Soc_ShareSocialNote (void)
if (IAmTheAuthor)
IAmAPublisherOfThisSocNot = true;
else
IAmAPublisherOfThisSocNot = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAPublisherOfThisSocNot = Soc_CheckIfNotIsPublishedInTimelineByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
ICanShare = (Gbl.Usrs.Me.Logged &&
!IAmTheAuthor && // I am not the author
!IAmAPublisherOfThisSocNot); // I have not shared the note
@ -2753,8 +2807,8 @@ static long Soc_FavSocialNote (void)
if (SocNot.NotCod > 0)
{
IAmTheAuthor = (SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAFavouriterOfThisSocNot = Soc_CheckIfNoteIsFavouritedByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAFavouriterOfThisSocNot = Soc_CheckIfNotIsFavouritedByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
ICanFav = (Gbl.Usrs.Me.Logged &&
!IAmTheAuthor && // I am not the author
!IAmAFavouriterOfThisSocNot); // I have not favourited the note
@ -2762,7 +2816,7 @@ static long Soc_FavSocialNote (void)
{
/***** Mark as favourite in database *****/
sprintf (Query,"INSERT IGNORE INTO social_notes_fav"
" (NotCod,UsrCod) VALUES ('%ld','%ld')",
" (NotCod,UsrCod,TimeFav) VALUES ('%ld','%ld',NOW())",
SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryINSERT (Query,"can not favourite social note");
@ -2770,8 +2824,7 @@ static long Soc_FavSocialNote (void)
/* Update number of times this social note is favourited */
Soc_UpdateNumTimesANoteHasBeenFav (&SocNot);
/***** Show the social note corresponding
to the publishing just fav *****/
/***** Show the social note just favourited *****/
Soc_WriteSocialNote (&SocNot,
Soc_TOP_MESSAGE_FAV,Gbl.Usrs.Me.UsrDat.UsrCod,
true,true);
@ -2783,6 +2836,92 @@ static long Soc_FavSocialNote (void)
return SocNot.NotCod;
}
/*****************************************************************************/
/********************* Mark a social comment as favourite ********************/
/*****************************************************************************/
void Soc_FavSocialCommentGbl (void)
{
long NotCod;
/***** Mark social comment as favourite *****/
NotCod = Soc_FavSocialComment ();
/***** Write updated timeline after marking as favourite (global) *****/
Soc_ShowTimelineGblHighlightingNot (NotCod);
}
void Soc_FavSocialCommentUsr (void)
{
long NotCod;
/***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Show user's profile *****/
Prf_ShowUserProfile ();
/***** Start section *****/
fprintf (Gbl.F.Out,"<section id=\"timeline\">");
/***** Mark social comment as favourite *****/
NotCod = Soc_FavSocialComment ();
/***** Write updated timeline after marking as favourite (user) *****/
Soc_ShowTimelineUsrHighlightingNot (NotCod);
/***** End section *****/
fprintf (Gbl.F.Out,"</section>");
}
static long Soc_FavSocialComment (void)
{
extern const char *Txt_The_original_comment_no_longer_exists;
struct SocialComment SocCom;
bool IAmTheAuthor;
bool IAmAFavouriterOfThisSocCom;
bool ICanFav;
char Query[256];
/***** Get the code of the social note to mark as favourite *****/
SocCom.ComCod = Soc_GetParamComCod ();
/***** Get data of social note *****/
Soc_GetDataOfSocialCommentByCod (&SocCom);
if (SocCom.ComCod > 0 &&
SocCom.NotCod > 0) // Extra check
{
IAmTheAuthor = (SocCom.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAFavouriterOfThisSocCom = Soc_CheckIfComIsFavouritedByUsr (SocCom.ComCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
ICanFav = (Gbl.Usrs.Me.Logged &&
!IAmTheAuthor && // I am not the author
!IAmAFavouriterOfThisSocCom); // I have not favourited the comment
if (ICanFav)
{
/***** Mark as favourite in database *****/
sprintf (Query,"INSERT IGNORE INTO social_comments_fav"
" (ComCod,UsrCod,TimeFav) VALUES ('%ld','%ld',NOW())",
SocCom.ComCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryINSERT (Query,"can not favourite social comment");
/* Update number of times this social comment is favourited */
Soc_UpdateNumTimesACommentHasBeenFav (&SocCom);
/***** Show the social comment just favourited *****/
Soc_WriteSocialComment (&SocCom,
Soc_TOP_MESSAGE_FAV,Gbl.Usrs.Me.UsrDat.UsrCod,
true);
}
}
else
Lay_ShowAlert (Lay_WARNING,Txt_The_original_comment_no_longer_exists);
return SocCom.NotCod;
}
/*****************************************************************************/
/***************** Unshare a previously shared social note *******************/
/*****************************************************************************/
@ -2827,6 +2966,7 @@ static long Soc_UnshareSocialNote (void)
bool IAmTheAuthor;
bool IAmAPublisherOfThisSocNot;
bool ICanUnshare;
char Query[256];
/***** Get data of social note *****/
SocNot.NotCod = Soc_GetParamNotCod ();
@ -2836,15 +2976,22 @@ static long Soc_UnshareSocialNote (void)
if (IAmTheAuthor)
IAmAPublisherOfThisSocNot = true;
else
IAmAPublisherOfThisSocNot = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAPublisherOfThisSocNot = Soc_CheckIfNotIsPublishedInTimelineByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
ICanUnshare = (Gbl.Usrs.Me.Logged &&
!IAmTheAuthor && // I am not the author
IAmAPublisherOfThisSocNot); // I have shared the note
if (ICanUnshare)
{
/***** Delete social publishing from database *****/
Soc_UnshareASocialPublishingFromDB (&SocNot);
sprintf (Query,"DELETE FROM social_pubs"
" WHERE NotCod='%ld'"
" AND PublisherCod='%ld'" // I have share this note
" AND PubType='%u'", // It's a shared note
SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Soc_PUB_SHARED_NOTE);
DB_QueryDELETE (Query,"can not remove a social publishing");
/***** Update number of times this social note is shared *****/
Soc_UpdateNumTimesANoteHasBeenShared (&SocNot);
@ -2859,25 +3006,6 @@ static long Soc_UnshareSocialNote (void)
return SocNot.NotCod;
}
/*****************************************************************************/
/**************** Unshare a social publishing from database ******************/
/*****************************************************************************/
static void Soc_UnshareASocialPublishingFromDB (struct SocialNote *SocNot)
{
char Query[128];
/***** Remove social publishing *****/
sprintf (Query,"DELETE FROM social_pubs"
" WHERE NotCod='%ld'"
" AND PublisherCod='%ld'" // I have share this note
" AND PubType='%u'", // It's a shared note
SocNot->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) Soc_PUB_SHARED_NOTE);
DB_QueryDELETE (Query,"can not remove a social publishing");
}
/*****************************************************************************/
/******* Stop marking as favourite a previously favourited social note *******/
/*****************************************************************************/
@ -2906,7 +3034,7 @@ void Soc_UnfavSocialNoteUsr (void)
/***** Start section *****/
fprintf (Gbl.F.Out,"<section id=\"timeline\">");
/***** Unshare a previously shared social note *****/
/***** Unfav a social note previously marked as favourite *****/
NotCod = Soc_UnfavSocialNote ();
/***** Write updated timeline after unfav (user) *****/
@ -2929,8 +3057,8 @@ static long Soc_UnfavSocialNote (void)
Soc_GetDataOfSocialNoteByCod (&SocNot);
IAmTheAuthor = (SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAFavouriterOfThisSocNot = Soc_CheckIfNoteIsFavouritedByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAFavouriterOfThisSocNot = Soc_CheckIfNotIsFavouritedByUsr (SocNot.NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
ICanUnfav = (Gbl.Usrs.Me.Logged &&
!IAmTheAuthor && // I am not the author
IAmAFavouriterOfThisSocNot); // I have favourited the note
@ -2946,8 +3074,7 @@ static long Soc_UnfavSocialNote (void)
/***** Update number of times this social note is favourited *****/
Soc_UpdateNumTimesANoteHasBeenFav (&SocNot);
/***** Show the social note corresponding
to the publishing just unfavourited *****/
/***** Show the social note just unfavourited *****/
Soc_WriteSocialNote (&SocNot,
Soc_TOP_MESSAGE_UNFAV,Gbl.Usrs.Me.UsrDat.UsrCod,
true,true);
@ -2956,6 +3083,83 @@ static long Soc_UnfavSocialNote (void)
return SocNot.NotCod;
}
/*****************************************************************************/
/***** Stop marking as favourite a previously favourited social comment *****/
/*****************************************************************************/
void Soc_UnfavSocialCommentGbl (void)
{
long NotCod;
/***** Stop marking as favourite a previously favourited social comment *****/
NotCod = Soc_UnfavSocialComment ();
/***** Write updated timeline after unfav (global) *****/
Soc_ShowTimelineGblHighlightingNot (NotCod);
}
void Soc_UnfavSocialCommentUsr (void)
{
long NotCod;
/***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Show user's profile *****/
Prf_ShowUserProfile ();
/***** Start section *****/
fprintf (Gbl.F.Out,"<section id=\"timeline\">");
/***** Unfav a social comment previously marked as favourite *****/
NotCod = Soc_UnfavSocialComment ();
/***** Write updated timeline after unfav (user) *****/
Soc_ShowTimelineUsrHighlightingNot (NotCod);
/***** End section *****/
fprintf (Gbl.F.Out,"</section>");
}
static long Soc_UnfavSocialComment (void)
{
struct SocialComment SocCom;
bool IAmTheAuthor;
bool IAmAFavouriterOfThisSocCom;
bool ICanUnfav;
char Query[256];
/***** Get data of social comment *****/
SocCom.ComCod = Soc_GetParamComCod ();
Soc_GetDataOfSocialCommentByCod (&SocCom);
IAmTheAuthor = (SocCom.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod);
IAmAFavouriterOfThisSocCom = Soc_CheckIfComIsFavouritedByUsr (SocCom.ComCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
ICanUnfav = (Gbl.Usrs.Me.Logged &&
!IAmTheAuthor && // I am not the author
IAmAFavouriterOfThisSocCom); // I have favourited the comment
if (ICanUnfav)
{
/***** Delete the mark as favourite from database *****/
sprintf (Query,"DELETE FROM social_comments_fav"
" WHERE ComCod='%ld' AND UsrCod='%ld'",
SocCom.ComCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
DB_QueryDELETE (Query,"can not unfavourite social comment");
/***** Update number of times this social comment is favourited *****/
Soc_UpdateNumTimesACommentHasBeenFav (&SocCom);
/***** Show the social comment just unfavourited *****/
Soc_WriteSocialComment (&SocCom,
Soc_TOP_MESSAGE_UNFAV,Gbl.Usrs.Me.UsrDat.UsrCod,
true);
}
return SocCom.NotCod;
}
/*****************************************************************************/
/******************* Request the removal of a social note ********************/
/*****************************************************************************/
@ -3005,7 +3209,7 @@ static void Soc_RequestRemovalSocialNote (void)
SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); // I am the author of this note
if (ICanRemove)
{
if (Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,SocNot.UsrCod))
if (Soc_CheckIfNotIsPublishedInTimelineByUsr (SocNot.NotCod,SocNot.UsrCod))
{
/***** Show warning and social note *****/
/* Warning message */
@ -3388,7 +3592,7 @@ void Soc_RemoveUsrSocialContent (long UsrCod)
/**************** Check if a user has published a social note ****************/
/*****************************************************************************/
static bool Soc_CheckIfNoteIsPublishedInTimelineByUsr (long NotCod,long UsrCod)
static bool Soc_CheckIfNotIsPublishedInTimelineByUsr (long NotCod,long UsrCod)
{
char Query[256];
@ -3406,7 +3610,7 @@ static bool Soc_CheckIfNoteIsPublishedInTimelineByUsr (long NotCod,long UsrCod)
/*************** Check if a user has favourited a social note ****************/
/*****************************************************************************/
static bool Soc_CheckIfNoteIsFavouritedByUsr (long NotCod,long UsrCod)
static bool Soc_CheckIfNotIsFavouritedByUsr (long NotCod,long UsrCod)
{
char Query[256];
@ -3416,6 +3620,20 @@ static bool Soc_CheckIfNoteIsFavouritedByUsr (long NotCod,long UsrCod)
return (DB_QueryCOUNT (Query,"can not check if a user has favourited a social note") != 0);
}
/*****************************************************************************/
/************* Check if a user has favourited a social comment ***************/
/*****************************************************************************/
static bool Soc_CheckIfComIsFavouritedByUsr (long ComCod,long UsrCod)
{
char Query[256];
sprintf (Query,"SELECT COUNT(*) FROM social_comments_fav"
" WHERE ComCod='%ld' AND UsrCod='%ld'",
ComCod,UsrCod);
return (DB_QueryCOUNT (Query,"can not check if a user has favourited a social comment") != 0);
}
/*****************************************************************************/
/******** Get number of times a note code has been shared in timeline ********/
/*****************************************************************************/
@ -3495,7 +3713,7 @@ static void Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (const struct SocialNote *S
}
/*****************************************************************************/
/********* Show users who have marked this social note as favourite **********/
/************************ Show sharers or favouriters ************************/
/*****************************************************************************/
// All forms in this function and nested functions must have unique identifiers

View File

@ -115,11 +115,15 @@ void Soc_ShareSocialNoteGbl (void);
void Soc_ShareSocialNoteUsr (void);
void Soc_FavSocialNoteGbl (void);
void Soc_FavSocialNoteUsr (void);
void Soc_FavSocialCommentGbl (void);
void Soc_FavSocialCommentUsr (void);
void Soc_UnshareSocialNoteGbl (void);
void Soc_UnshareSocialNoteUsr (void);
void Soc_UnfavSocialNoteGbl (void);
void Soc_UnfavSocialNoteUsr (void);
void Soc_UnfavSocialCommentGbl (void);
void Soc_UnfavSocialCommentUsr (void);
void Soc_RequestRemSocialNoteGbl (void);
void Soc_RequestRemSocialNoteUsr (void);