diff --git a/css/swad15.113.8.css b/css/swad15.113.8.css index 2d493648e..d59045a50 100644 --- a/css/swad15.113.8.css +++ b/css/swad15.113.8.css @@ -1689,6 +1689,11 @@ a:hover img.CENTRE_PHOTO_SHOW padding:0; } +.SOCIAL_PUB + { + width:536px; + border-top:1px solid silver; + } .SOCIAL_NEW_PUB { background-color:#DDECF1; @@ -1698,12 +1703,6 @@ a:hover img.CENTRE_PHOTO_SHOW { to {background-color:white;} } - -.SOCIAL_PUB - { - width:536px; - border-top:1px solid silver; - } .SOCIAL_TOP_CONTAINER { box-sizing:border-box; diff --git a/swad_changelog.h b/swad_changelog.h index 6504f0ee7..0413e0464 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -124,13 +124,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.113.10 (2016-01-15)" +#define Log_PLATFORM_VERSION "SWAD 15.113.11 (2016-01-15)" #define CSS_FILE "swad15.113.8.css" #define JS_FILE "swad15.113.8.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.113.11:Jan 15, 2016 When a new social post is received, fade its background. (192803 lines) Version 15.113.10:Jan 15, 2016 When a social note is not available, the button to comment is disabled. Fixed bug receiving a comment to a social note. (192781 lines) Version 15.113.9: Jan 15, 2016 "..." changed by HTML entity "…". (192775 lines) diff --git a/swad_social.c b/swad_social.c index 0b997539d..6bc0bdd5c 100644 --- a/swad_social.c +++ b/swad_social.c @@ -215,6 +215,9 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ +static void Soc_ShowTimelineGblHighlightingNot (long NotCod); +static void Soc_ShowTimelineUsrHighlightingNot (long NotCod); + static void Soc_GetAndShowNewTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl); static void Soc_GetAndShowOldTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl); @@ -226,8 +229,9 @@ static void Soc_UpdateLastPubCodIntoSession (void); static void Soc_UpdateFirstPubCodIntoSession (long FirstPubCod); static void Soc_DropTemporaryTablesUsedToQueryTimeline (void); -static void Soc_ShowTimeline (const char *Query,const char *Title); -static void Soc_ShowNewPubsInTimeline (const char *Query); +static void Soc_ShowTimeline (const char *Query,const char *Title, + long NotCodToHighlight); +static void Soc_InsertNewPubsInTimeline (const char *Query); static void Soc_ShowOldPubsInTimeline (const char *Query); static void Soc_GetDataOfSocialPublishingFromRow (MYSQL_ROW row,struct SocialPublishing *SocPub); @@ -237,8 +241,8 @@ static void Soc_PutLinkToViewOldPublishings (void); static void Soc_WriteSocialNote (const struct SocialNote *SocNot, const struct SocialPublishing *SocPub, - bool ShowNoteAlone, - bool ViewTopLine); + bool Highlight, + bool ShowNoteAlone); static void Soc_WriteTopPublisher (const struct SocialPublishing *SocPub); static void Soc_WriteAuthorNote (struct UsrData *UsrDat); static void Soc_WriteDateTime (time_t TimeUTC); @@ -251,7 +255,7 @@ static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub); static void Soc_PutFormToWriteNewPost (void); static void Soc_PutTextarea (const char *Placeholder); -static void Soc_ReceiveSocialPost (void); +static long Soc_ReceiveSocialPost (void); static void Soc_PutIconToToggleCommentSocialNote (const char UniqueId[Soc_MAX_LENGTH_ID], bool PutText); @@ -310,33 +314,16 @@ static void Soc_SetUniqueId (char UniqueId[Soc_MAX_LENGTH_ID]); static void Soc_ClearTimelineForThisSession (void); static bool Soc_StoreSocialNoteInTimeline (long NotCod); -/*****************************************************************************/ -/*********** Show social activity (timeline) of a selected user **************/ -/*****************************************************************************/ - -void Soc_ShowTimelineUsr (void) - { - extern const char *Txt_Public_activity_OF_A_USER; - char Query[512]; - - /***** Build query to show timeline with publishings of a unique user *****/ - Soc_BuildQueryToGetTimeline (Soc_TIMELINE_USR, - Soc_GET_RECENT_TIMELINE, - Query); - - /***** Show timeline *****/ - sprintf (Gbl.Title,Txt_Public_activity_OF_A_USER,Gbl.Usrs.Other.UsrDat.FirstName); - Soc_ShowTimeline (Query,Gbl.Title); - - /***** Drop temporary tables *****/ - Soc_DropTemporaryTablesUsedToQueryTimeline (); - } - /*****************************************************************************/ /***** Show social activity (timeline) including all the users I follow ******/ /*****************************************************************************/ void Soc_ShowTimelineGbl (void) + { + Soc_ShowTimelineGblHighlightingNot (-1L); + } + +static void Soc_ShowTimelineGblHighlightingNot (long NotCod) { extern const char *Txt_Public_activity; extern const char *Txt_You_dont_follow_any_user; @@ -352,7 +339,34 @@ void Soc_ShowTimelineGbl (void) Query); /***** Show timeline *****/ - Soc_ShowTimeline (Query,Txt_Public_activity); + Soc_ShowTimeline (Query,Txt_Public_activity,NotCod); + + /***** Drop temporary tables *****/ + Soc_DropTemporaryTablesUsedToQueryTimeline (); + } + +/*****************************************************************************/ +/*********** Show social activity (timeline) of a selected user **************/ +/*****************************************************************************/ + +void Soc_ShowTimelineUsr (void) + { + Soc_ShowTimelineUsrHighlightingNot (-1L); + } + +static void Soc_ShowTimelineUsrHighlightingNot (long NotCod) + { + extern const char *Txt_Public_activity_OF_A_USER; + char Query[512]; + + /***** Build query to show timeline with publishings of a unique user *****/ + Soc_BuildQueryToGetTimeline (Soc_TIMELINE_USR, + Soc_GET_RECENT_TIMELINE, + Query); + + /***** Show timeline *****/ + sprintf (Gbl.Title,Txt_Public_activity_OF_A_USER,Gbl.Usrs.Other.UsrDat.FirstName); + Soc_ShowTimeline (Query,Gbl.Title,NotCod); /***** Drop temporary tables *****/ Soc_DropTemporaryTablesUsedToQueryTimeline (); @@ -385,7 +399,7 @@ static void Soc_GetAndShowNewTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl) Query); /***** Show new timeline *****/ - Soc_ShowNewPubsInTimeline (Query); + Soc_InsertNewPubsInTimeline (Query); /***** Drop temporary tables *****/ Soc_DropTemporaryTablesUsedToQueryTimeline (); @@ -398,11 +412,9 @@ static void Soc_GetAndShowNewTimeline (Soc_TimelineUsrOrGbl_t TimelineUsrOrGbl) /************ View new publishings in social timeline via AJAX ***************/ /*****************************************************************************/ -void Soc_GetOtherUsrNicknameFromUsrCod (void) +void Soc_RefreshOldTimelineGbl (void) { - // User's code is already taken from nickname in Par_GetMainParameters () - if (!Nck_GetNicknameFromUsrCod (Gbl.Usrs.Other.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.Nickname)) - Gbl.Usrs.Other.UsrDat.UsrCod = -1L; + Soc_GetAndShowOldTimeline (Soc_TIMELINE_GBL); } void Soc_RefreshOldTimelineUsr (void) @@ -413,11 +425,6 @@ void Soc_RefreshOldTimelineUsr (void) Soc_GetAndShowOldTimeline (Soc_TIMELINE_USR); } -void Soc_RefreshOldTimelineGbl (void) - { - Soc_GetAndShowOldTimeline (Soc_TIMELINE_GBL); - } - /*****************************************************************************/ /**************** Get and show old publishings in timeline *******************/ /*****************************************************************************/ @@ -648,7 +655,8 @@ static void Soc_DropTemporaryTablesUsedToQueryTimeline (void) /*********************** Show social activity (timeline) *********************/ /*****************************************************************************/ -static void Soc_ShowTimeline (const char *Query,const char *Title) +static void Soc_ShowTimeline (const char *Query,const char *Title, + long NotCodToHighlight) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -706,7 +714,9 @@ static void Soc_ShowTimeline (const char *Query,const char *Title) if (!AlreadyWasInTimeline) // This check is not necessary // because we have got publishing // not yet in timeline - Soc_WriteSocialNote (&SocNot,&SocPub,false,true); + Soc_WriteSocialNote (&SocNot,&SocPub, + SocNot.NotCod == NotCodToHighlight, + false); } fprintf (Gbl.F.Out,""); @@ -734,7 +744,7 @@ static void Soc_ShowTimeline (const char *Query,const char *Title) /*****************************************************************************/ // The publishings are inserted as list elements of a hidden list -static void Soc_ShowNewPubsInTimeline (const char *Query) +static void Soc_InsertNewPubsInTimeline (const char *Query) { MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -764,7 +774,7 @@ static void Soc_ShowNewPubsInTimeline (const char *Query) /* Write social note */ // New publishings are written even if the note was already un timeline - Soc_WriteSocialNote (&SocNot,&SocPub,false,true); + Soc_WriteSocialNote (&SocNot,&SocPub,false,false); } /***** Free structure that stores the query result *****/ @@ -811,7 +821,7 @@ static void Soc_ShowOldPubsInTimeline (const char *Query) if (!AlreadyWasInTimeline) // This check is not necessary // because we have got publishing // not yet in timeline - Soc_WriteSocialNote (&SocNot,&SocPub,false,true); + Soc_WriteSocialNote (&SocNot,&SocPub,false,false); } /***** Store first publishing code into session *****/ @@ -873,8 +883,8 @@ static void Soc_PutLinkToViewOldPublishings (void) static void Soc_WriteSocialNote (const struct SocialNote *SocNot, const struct SocialPublishing *SocPub, - bool ShowNoteAlone, // Social note is shown alone, not in a list - bool ViewTopLine) // Separate with a top line from previous social note + bool Highlight, // hightlight social notee > 0 + bool ShowNoteAlone) // Social note is shown alone, not in a list { extern const char *Txt_Forum; extern const char *Txt_Course; @@ -904,10 +914,15 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot, /***** Start list item *****/ fprintf (Gbl.F.Out,"