diff --git a/swad_changelog.h b/swad_changelog.h index c03dff063..ac1996c04 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -118,13 +118,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.97.5 (2016-01-04)" +#define Log_PLATFORM_VERSION "SWAD 15.98 (2016-01-05)" #define CSS_FILE "swad15.97.css" #define JS_FILE "swad15.77.7.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.98: Jan 05, 2016 If a social note is unavailable and is shared, put button to unshare. + Several bugs in social timeline fixed. (190789 lines) Version 15.97.5: Jan 04, 2016 Button to remove a social note is not shown if author already removed the note (but it yet exists because another user shared it). (190763 lines) Version 15.97.4: Jan 04, 2016 Guests can see and write in global forums. (190758 lines) Version 15.97.3: Jan 04, 2016 Link to user's privacy in my public profile. (190755 lines) diff --git a/swad_social.c b/swad_social.c index c0aa1b05c..5b20bd12d 100644 --- a/swad_social.c +++ b/swad_social.c @@ -148,24 +148,22 @@ static void Soc_PutLinkToWriteANewPost (Act_Action_t Action,void (*FuncParams) ( static void Soc_FormSocialPost (void); static void Soc_ReceiveSocialPost (void); -static void Soc_PutIconShared (void); -static void Soc_PutFormToShareSocialNote (long NotCod); +static void Soc_PutDisabledIconShare (void); +static void Soc_PutFormToShareSocialNote (long PubCod); static void Soc_PutFormToUnshareSocialPublishing (long PubCod); static void Soc_PutFormToRemoveSocialPublishing (long PubCod); -static void Soc_PutHiddenParamNotCod (long NotCod); -static long Soc_GetParamNotCod (void); static void Soc_PutHiddenParamPubCod (long PubCod); static long Soc_GetParamPubCod (void); static void Soc_ShareSocialNote (void); static void Soc_UnshareSocialPublishing (void); -static void Soc_UnshareASocialPublishingFromDB (const struct SocialNote *SocNot); +static void Soc_UnshareASocialPublishingFromDB (struct SocialNote *SocNot); static void Soc_RequestRemovalSocialPublishing (void); static void Soc_RemoveSocialPublishing (void); static void Soc_RemoveASocialPublishingFromDB (const struct SocialPublishing *SocPub, - const struct SocialNote *SocNot); -static void Soc_CheckAndDeleteASocialNoteFromDB (const struct SocialNote *SocNot); + struct SocialNote *SocNot); +static void Soc_CheckAndDeleteASocialNoteFromDB (struct SocialNote *SocNot); static bool Soc_CheckIfNoteIsPublishedInTimelineByUsr (long NotCod,long UsrCod); static unsigned long Soc_GetNumPubsOfANote (long NotCod); @@ -175,6 +173,8 @@ static void Soc_GetDataOfSocialPublishingByCod (struct SocialPublishing *SocPub) static void Soc_GetDataOfSocialNoteByCod (struct SocialNote *SocNot); static void Soc_GetDataOfSocialNoteFromRow (MYSQL_ROW row,struct SocialNote *SocNot); static Soc_NoteType_t Soc_GetNoteTypeFromStr (const char *Str); +static void Soc_ResetSocialPublishing (struct SocialPublishing *SocPub); +static void Soc_ResetSocialNote (struct SocialNote *SocNot); /*****************************************************************************/ /*********** Show social activity (timeline) of a selected user **************/ @@ -307,14 +307,16 @@ static void Soc_ShowTimeline (const char *Query,Act_Action_t UpdateAction, NumPub < NumPublishings; NumPub++) { - /* Get next social publishing */ + /* Get data of social publishing */ row = mysql_fetch_row (mysql_res); Soc_GetDataOfSocialPublishingFromRow (row,&SocPub); - /* Get and write social note */ - SocNot.NotCod = SocPub.NotCod; - Soc_GetDataOfSocialNoteByCod (&SocNot); - Soc_WriteSocialNote (&SocPub,&SocNot,true,NumPub == NumPublishings - 1); + /* Get data of social note */ + SocNot.NotCod = SocPub.NotCod; + Soc_GetDataOfSocialNoteByCod (&SocNot); + + /* Write social note */ + Soc_WriteSocialNote (&SocPub,&SocNot,true,NumPub == NumPublishings - 1); } /***** End list *****/ @@ -368,6 +370,8 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub, extern const char *Txt_Centre; extern const char *Txt_Institution; struct UsrData UsrDat; + bool IAmTheAuthor = false; + bool IAmAPublisherOfThisSocNot = false; struct Institution Ins; struct Centre Ctr; struct Degree Deg; @@ -377,187 +381,204 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub, char ForumName[512]; char SummaryStr[Cns_MAX_BYTES_TEXT+1]; - /***** Initialize location in hierarchy *****/ - Ins.InsCod = -1L; - Ctr.CtrCod = -1L; - Deg.DegCod = -1L; - Crs.CrsCod = -1L; - - /***** Get author data *****/ - Usr_UsrDataConstructor (&UsrDat); - UsrDat.UsrCod = SocNot->UsrCod; - Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); - /***** Start list item *****/ fprintf (Gbl.F.Out,"