diff --git a/css/swad15.97.css b/css/swad15.100.2.css similarity index 99% rename from css/swad15.97.css rename to css/swad15.100.2.css index 3f3ebd88f..1cddc9fd4 100644 --- a/css/swad15.97.css +++ b/css/swad15.100.2.css @@ -1739,6 +1739,10 @@ a:hover img.CENTRE_PHOTO_SHOW padding-left:4px; vertical-align:bottom; } +.SOCIAL_FORM_COMMENT + { + padding-top:10px; + } /*********************************** Messages ********************************/ .MSG_TO_ONE_RCP diff --git a/js/swad15.77.7.js b/js/swad15.100.2.js similarity index 99% rename from js/swad15.77.7.js rename to js/swad15.100.2.js index bd023259d..3eb15f961 100644 --- a/js/swad15.77.7.js +++ b/js/swad15.100.2.js @@ -463,6 +463,13 @@ function noZoom() { document.getElementById('zoomLyr').style.top = yPos + 'px'; } +// Change display of a element (hidden or visible) +function toggleDisplay(elementID) { + (function(style) { + style.display = style.display === 'none' ? '' : 'none'; + })(document.getElementById(elementID).style); +} + // Select or unselect a radio element in a form function selectUnselectRadio (radio,groupRadios,numRadiosInGroup){ if (radio.IsChecked) radio.checked = false; diff --git a/swad_changelog.h b/swad_changelog.h index ef410732c..f24f950ec 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -124,13 +124,15 @@ En definitiva, se estar /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.100.1 (2016-01-07)" -#define CSS_FILE "swad15.97.css" -#define JS_FILE "swad15.77.7.js" +#define Log_PLATFORM_VERSION "SWAD 15.100.3 (2016-01-07)" +#define CSS_FILE "swad15.100.2.css" +#define JS_FILE "swad15.100.2.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.100.3: Jan 07, 2016 Fixed bug when sharing and unsharing a social note. (190999 lines) + Version 15.100.2: Jan 07, 2016 Hidden form to reply a social note. (190983 lines) Version 15.100.1: Jan 07, 2016 New icon in social note to reply. (190937 lines) Version 15.100: Jan 06, 2016 When an author removes a social note, all the publishings of this note are removed. (190842 lines) Version 15.99.1: Jan 05, 2016 Change in message in social timeline. (190917 lines) diff --git a/swad_social.c b/swad_social.c index 3f53428b8..06fad003f 100644 --- a/swad_social.c +++ b/swad_social.c @@ -150,6 +150,7 @@ static void Soc_FormSocialPost (void); static void Soc_ReceiveSocialPost (void); static void Soc_PutFormToCommentSocialNote (long NotCod); +static void Soc_PutHiddenFormToSendCommentToASocialNote (long NotCod); static void Soc_PutDisabledIconShare (unsigned NumShared); static void Soc_PutFormToShareSocialNote (long NotCod); static void Soc_PutFormToUnshareSocialPublishing (long PubCod); @@ -577,6 +578,9 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub, /* Put icon to remove this publishing */ Soc_PutFormToRemoveSocialPublishing (SocPub->PubCod); + /* Put hidden form to write comment */ + Soc_PutHiddenFormToSendCommentToASocialNote (SocNot->NotCod); + /* End of right part */ fprintf (Gbl.F.Out,""); @@ -1162,14 +1166,57 @@ static void Soc_PutFormToCommentSocialNote (long NotCod) "" + " class=\"ICON20x20\"" + " onclick=\"" + "toggleDisplay('div_comment_%ld');" + "return false;\" />" "", Gbl.Prefs.IconsURL, Txt_Comment, - Txt_Comment); + Txt_Comment, + NotCod); Act_FormEnd (); } +/*****************************************************************************/ +/******************* Form to comment a social publishing *********************/ +/*****************************************************************************/ + +static void Soc_PutHiddenFormToSendCommentToASocialNote (long NotCod) + { + extern const char *Txt_Send_comment; + + /***** Start container *****/ + fprintf (Gbl.F.Out,"
", + NotCod); + + /***** Start form to write the post *****/ + if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) + { + Act_FormStartAnchor (ActComSocNotUsr,"timeline"); + Usr_PutParamOtherUsrCodEncrypted (); + } + else + Act_FormStart (ActComSocNotGbl); + fprintf (Gbl.F.Out,"", + NotCod); + + /***** Send button *****/ + fprintf (Gbl.F.Out,"", + Txt_Send_comment); + + /***** End form *****/ + Act_FormEnd (); + + /***** En container *****/ + fprintf (Gbl.F.Out,"
"); + } + /*****************************************************************************/ /*********************** Put disabled icon to share **************************/ /*****************************************************************************/ @@ -1410,8 +1457,9 @@ static void Soc_ShareSocialNote (void) extern const char *Txt_SOCIAL_PUBLISHING_Shared; struct SocialNote SocNot; struct SocialPublishing SocPub; + bool IAmTheAuthor; + bool IAmAPublisherOfThisSocNot; bool ICanShare; - bool IHavePublishedThisNote; /***** Get the code of the social publishing to unshare *****/ SocPub.NotCod = Soc_GetParamNotCod (); @@ -1419,29 +1467,31 @@ static void Soc_ShareSocialNote (void) /***** Get data of social note *****/ Soc_GetDataOfSocialNoteByCod (&SocNot); + IAmTheAuthor = (SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); + if (IAmTheAuthor) + IAmAPublisherOfThisSocNot = true; + else + IAmAPublisherOfThisSocNot = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod, + Gbl.Usrs.Me.UsrDat.UsrCod); ICanShare = (Gbl.Usrs.Me.Logged && - SocNot.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod); // I am not the author + !IAmTheAuthor && // I am not the author + !IAmAPublisherOfThisSocNot); // I have not shared the note if (ICanShare) { - /***** Check if I have yet shared this social note *****/ - IHavePublishedThisNote = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod,Gbl.Usrs.Me.UsrDat.UsrCod); - if (!IHavePublishedThisNote) - { - /***** Share (publish social note in timeline) *****/ - SocPub.AuthorCod = SocNot.UsrCod; - SocPub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod; - SocPub.NotCod = SocNot.NotCod; - Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod + /***** Share (publish social note in timeline) *****/ + SocPub.AuthorCod = SocNot.UsrCod; + SocPub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod; + SocPub.NotCod = SocNot.NotCod; + Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod - /* Update number of times this social note is shared */ - Soc_UpdateNumTimesANoteHasBeenShared (&SocNot); + /* Update number of times this social note is shared */ + Soc_UpdateNumTimesANoteHasBeenShared (&SocNot); - /***** Message of success *****/ - Lay_ShowAlert (Lay_SUCCESS,Txt_SOCIAL_PUBLISHING_Shared); + /***** Message of success *****/ + Lay_ShowAlert (Lay_SUCCESS,Txt_SOCIAL_PUBLISHING_Shared); - /***** Show the social note just shared *****/ - Soc_WriteSocialNote (&SocPub,&SocNot,true,true); - } + /***** Show the social note just shared *****/ + Soc_WriteSocialNote (&SocPub,&SocNot,true,true); } } @@ -1484,6 +1534,8 @@ static void Soc_UnshareSocialPublishing (void) extern const char *Txt_SOCIAL_PUBLISHING_Unshared; struct SocialPublishing SocPub; struct SocialNote SocNot; + bool IAmTheAuthor; + bool IAmAPublisherOfThisSocNot; bool ICanUnshare; /***** Get the code of the social publishing to unshare *****/ @@ -1496,9 +1548,15 @@ static void Soc_UnshareSocialPublishing (void) SocNot.NotCod = SocPub.NotCod; Soc_GetDataOfSocialNoteByCod (&SocNot); + IAmTheAuthor = (SocNot.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod); + if (IAmTheAuthor) + IAmAPublisherOfThisSocNot = true; + else + IAmAPublisherOfThisSocNot = Soc_CheckIfNoteIsPublishedInTimelineByUsr (SocNot.NotCod, + Gbl.Usrs.Me.UsrDat.UsrCod); ICanUnshare = (Gbl.Usrs.Me.Logged && - SocPub.PublisherCod == Gbl.Usrs.Me.UsrDat.UsrCod && // I have shared the note - SocPub.AuthorCod != Gbl.Usrs.Me.UsrDat.UsrCod); // I am not the author + !IAmTheAuthor && // I am not the author + IAmAPublisherOfThisSocNot); // I have shared the note if (ICanUnshare) { /***** Delete social publishing from database *****/