Version 15.97.5

This commit is contained in:
Antonio Cañas Vargas 2016-01-04 17:36:28 +01:00
parent c03a8a2c8e
commit 66b0edb994
2 changed files with 37 additions and 32 deletions

View File

@ -118,13 +118,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.97.4 (2016-01-04)" #define Log_PLATFORM_VERSION "SWAD 15.97.5 (2016-01-04)"
#define CSS_FILE "swad15.97.css" #define CSS_FILE "swad15.97.css"
#define JS_FILE "swad15.77.7.js" #define JS_FILE "swad15.77.7.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
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.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) Version 15.97.3: Jan 04, 2016 Link to user's privacy in my public profile. (190755 lines)
Version 15.97.2: Jan 04, 2016 New option in user's privacy. (190743 lines) Version 15.97.2: Jan 04, 2016 New option in user's privacy. (190743 lines)

View File

@ -167,7 +167,7 @@ static void Soc_RemoveASocialPublishingFromDB (const struct SocialPublishing *So
const struct SocialNote *SocNot); const struct SocialNote *SocNot);
static void Soc_CheckAndDeleteASocialNoteFromDB (const struct SocialNote *SocNot); static void Soc_CheckAndDeleteASocialNoteFromDB (const struct SocialNote *SocNot);
static bool Soc_CheckIfNoteIsYetPublishedByMe (long NotCod); static bool Soc_CheckIfNoteIsPublishedInTimelineByUsr (long NotCod,long UsrCod);
static unsigned long Soc_GetNumPubsOfANote (long NotCod); static unsigned long Soc_GetNumPubsOfANote (long NotCod);
static void Soc_GetNumTimesANoteHasBeenShared (struct SocialNote *SocNot); static void Soc_GetNumTimesANoteHasBeenShared (struct SocialNote *SocNot);
static void Soc_ShowUsrsWhoHaveSharedSocialNote (const struct SocialNote *SocNot); static void Soc_ShowUsrsWhoHaveSharedSocialNote (const struct SocialNote *SocNot);
@ -529,7 +529,7 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
Soc_PutIconShared (); Soc_PutIconShared ();
else // I am not the author && not unavailable else // I am not the author && not unavailable
{ {
if (Soc_CheckIfNoteIsYetPublishedByMe (SocNot->NotCod)) if (Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot->NotCod,Gbl.Usrs.Me.UsrDat.UsrCod))
// I have yet published this social note // I have yet published this social note
/* Put icon to unshare this publishing */ /* Put icon to unshare this publishing */
Soc_PutFormToUnshareSocialPublishing (SocPub->PubCod); Soc_PutFormToUnshareSocialPublishing (SocPub->PubCod);
@ -546,8 +546,9 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
if (WritingTimeline && if (WritingTimeline &&
Gbl.Usrs.Me.Logged && Gbl.Usrs.Me.Logged &&
UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the author
/* Put icon to remove this publishing */ if (Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot->NotCod,SocNot->UsrCod))
Soc_PutFormToRemoveSocialPublishing (SocPub->PubCod); /* Put icon to remove this publishing */
Soc_PutFormToRemoveSocialPublishing (SocPub->PubCod);
/* End of right part */ /* End of right part */
fprintf (Gbl.F.Out,"</div>"); fprintf (Gbl.F.Out,"</div>");
@ -1311,7 +1312,7 @@ static void Soc_ShareSocialNote (void)
if (ICanShare) if (ICanShare)
{ {
/***** Check if I have yet shared this social note *****/ /***** Check if I have yet shared this social note *****/
IHavePublishedThisNote = Soc_CheckIfNoteIsYetPublishedByMe (SocNot.NotCod); IHavePublishedThisNote = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,Gbl.Usrs.Me.UsrDat.UsrCod);
if (!IHavePublishedThisNote) if (!IHavePublishedThisNote)
{ {
/***** Share (publish social note in timeline) *****/ /***** Share (publish social note in timeline) *****/
@ -1488,30 +1489,33 @@ static void Soc_RequestRemovalSocialPublishing (void)
SocPub.PublisherCod == Gbl.Usrs.Me.UsrDat.UsrCod); SocPub.PublisherCod == Gbl.Usrs.Me.UsrDat.UsrCod);
if (ICanRemove) if (ICanRemove)
{ {
/***** Form to ask for confirmation to remove this social post *****/ if (Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,SocNot.UsrCod))
/* Start form */
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
{ {
Act_FormStartAnchor (ActRemSocPubUsr,"timeline"); /***** Form to ask for confirmation to remove this social post *****/
Usr_PutParamOtherUsrCodEncrypted (); /* Start form */
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
{
Act_FormStartAnchor (ActRemSocPubUsr,"timeline");
Usr_PutParamOtherUsrCodEncrypted ();
}
else
Act_FormStart (ActRemSocPubGbl);
Soc_PutHiddenParamPubCod (SocPub.PubCod);
/* Warning message */
Lay_ShowAlert (Lay_WARNING,Txt_Do_you_really_want_to_remove_the_following_comment);
/* Show social note */
Lay_StartRoundFrame (Soc_WIDTH_TIMELINE,NULL);
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
Soc_WriteSocialNote (&SocPub,&SocNot,false,true);
fprintf (Gbl.F.Out,"</ul>");
Lay_EndRoundFrame ();
/* End form */
Lay_PutRemoveButton (Txt_Remove);
Act_FormEnd ();
} }
else
Act_FormStart (ActRemSocPubGbl);
Soc_PutHiddenParamPubCod (SocPub.PubCod);
/* Warning message */
Lay_ShowAlert (Lay_WARNING,Txt_Do_you_really_want_to_remove_the_following_comment);
/* Show social note */
Lay_StartRoundFrame (Soc_WIDTH_TIMELINE,NULL);
fprintf (Gbl.F.Out,"<ul class=\"LIST_LEFT\">");
Soc_WriteSocialNote (&SocPub,&SocNot,false,true);
fprintf (Gbl.F.Out,"</ul>");
Lay_EndRoundFrame ();
/* End form */
Lay_PutRemoveButton (Txt_Remove);
Act_FormEnd ();
} }
} }
@ -1640,17 +1644,17 @@ static void Soc_CheckAndDeleteASocialNoteFromDB (const struct SocialNote *SocNot
} }
/*****************************************************************************/ /*****************************************************************************/
/***** Check if I have published a social note (I authored or shared it) *****/ /**************** Check if a user has published a social note ****************/
/*****************************************************************************/ /*****************************************************************************/
static bool Soc_CheckIfNoteIsYetPublishedByMe (long NotCod) static bool Soc_CheckIfNoteIsPublishedInTimelineByUsr (long NotCod,long UsrCod)
{ {
char Query[128]; char Query[128];
sprintf (Query,"SELECT COUNT(*) FROM social_timeline" sprintf (Query,"SELECT COUNT(*) FROM social_timeline"
" WHERE NotCod='%ld' AND PublisherCod='%ld'", " WHERE NotCod='%ld' AND PublisherCod='%ld'",
NotCod,Gbl.Usrs.Me.UsrDat.UsrCod); NotCod,UsrCod);
return (DB_QueryCOUNT (Query,"can not check if you have published a social note") != 0); return (DB_QueryCOUNT (Query,"can not check if a user has published a social note") != 0);
} }
/*****************************************************************************/ /*****************************************************************************/