diff --git a/swad_changelog.h b/swad_changelog.h
index b75c1ae51..882a88d61 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -123,13 +123,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.107.2 (2016-01-11)"
+#define Log_PLATFORM_VERSION "SWAD 15.107.3 (2016-01-11)"
#define CSS_FILE "swad15.107.2.css"
#define JS_FILE "swad15.107.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.107.3: Jan 11, 2016 Fixed bug and code refactoring in social comments. (192160 lines)
Version 15.107.2: Jan 11, 2016 Hide link to see old publishings when oldest publishing is reached.
Some constants related to social timeline changed. (192159 lines)
Version 15.107.1: Jan 10, 2016 Id of dates in timeline must be unique.
diff --git a/swad_social.c b/swad_social.c
index 42179eac5..3cfdb8d61 100644
--- a/swad_social.c
+++ b/swad_social.c
@@ -209,7 +209,7 @@ static void Soc_PutLinkToViewOldPublishings (void);
static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
const struct SocialNote *SocNot,
- bool ShowAlone,
+ bool ShowNoteAlone,
bool ViewTopLine);
static void Soc_WriteDateTime (time_t TimeUTC);
static void Soc_GetAndWriteSocialPost (long PstCod);
@@ -221,12 +221,12 @@ static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub);
static void Soc_PutHiddenFormToWriteNewPost (void);
static void Soc_ReceiveSocialPost (void);
-static void Soc_PutIconToToggleCommentSocialNote (long NotCod,bool PutText);
-static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod);
+static void Soc_PutIconToToggleCommentSocialNote (long NotCod,bool PutText,bool ShowNoteAlone);
+static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod,bool ShowNoteAlone);
static unsigned long Soc_GetNumCommentsInSocialNote (long NotCod);
-static void Soc_WriteCommentsInSocialNote (long NotCod);
+static void Soc_WriteCommentsInSocialNote (long NotCod,unsigned long NumComments,bool ShowNoteAlone);
static void Soc_WriteSocialComment (struct SocialComment *SocCom,
- bool ShowAlone);
+ bool ShowCommentAlone);
static void Soc_PutFormToRemoveComment (long ComCod);
static void Soc_PutDisabledIconShare (unsigned NumShared);
static void Soc_PutFormToShareSocialNote (long NotCod);
@@ -706,7 +706,7 @@ static void Soc_PutLinkToViewOldPublishings (void)
static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
const struct SocialNote *SocNot,
- bool ShowAlone, // Social note is shown alone, not in a list
+ bool ShowNoteAlone, // Social note is shown alone, not in a list
bool ViewTopLine) // Separate with a top line from previous social note
{
extern const char *Txt_Forum;
@@ -727,7 +727,7 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
char SummaryStr[Cns_MAX_BYTES_TEXT+1];
unsigned NumComments;
- if (ShowAlone)
+ if (ShowNoteAlone)
{
Lay_StartRoundFrame (Soc_WIDTH_TIMELINE,NULL);
fprintf (Gbl.F.Out,"
");
@@ -735,7 +735,7 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
/***** Start list item *****/
fprintf (Gbl.F.Out,"- ");
@@ -899,7 +899,7 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
/* Put icon to add a comment */
if (!NumComments)
- Soc_PutIconToToggleCommentSocialNote (SocNot->NotCod,false);
+ Soc_PutIconToToggleCommentSocialNote (SocNot->NotCod,false,ShowNoteAlone);
/* Put icons to share/unshare */
if (IAmTheAuthor) // I am the author
@@ -921,15 +921,11 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
Soc_ShowUsrsWhoHaveSharedSocialNote (SocNot);
/* Put icon to remove this publishing */
- if (IAmTheAuthor && !ShowAlone)
+ if (IAmTheAuthor && !ShowNoteAlone)
Soc_PutFormToRemoveSocialPublishing (SocPub->PubCod);
- if (NumComments)
- /* Show current comments */
- Soc_WriteCommentsInSocialNote (SocNot->NotCod);
-
- /* Put hidden form to write a new comment */
- Soc_PutHiddenFormToWriteNewCommentToSocialNote (SocNot->NotCod);
+ /* Show comments */
+ Soc_WriteCommentsInSocialNote (SocNot->NotCod,NumComments,ShowNoteAlone);
/* End of right part */
fprintf (Gbl.F.Out,"");
@@ -941,7 +937,7 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
/***** End list item *****/
fprintf (Gbl.F.Out,"
");
- if (ShowAlone)
+ if (ShowNoteAlone)
{
fprintf (Gbl.F.Out,"
");
Lay_EndRoundFrame ();
@@ -1504,7 +1500,7 @@ static void Soc_ReceiveSocialPost (void)
/****** Put an icon to toggle on/off the form to comment a social note *******/
/*****************************************************************************/
-static void Soc_PutIconToToggleCommentSocialNote (long NotCod,bool PutText)
+static void Soc_PutIconToToggleCommentSocialNote (long NotCod,bool PutText,bool ShowNoteAlone)
{
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Comment;
@@ -1518,7 +1514,8 @@ static void Soc_PutIconToToggleCommentSocialNote (long NotCod,bool PutText)
"",
- NotCod,
+ ShowNoteAlone ? 0 :
+ NotCod,
Gbl.Prefs.IconsURL,
Txt_Comment,
Txt_Comment);
@@ -1532,7 +1529,7 @@ static void Soc_PutIconToToggleCommentSocialNote (long NotCod,bool PutText)
/******************* Form to comment a social publishing *********************/
/*****************************************************************************/
-static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod)
+static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod,bool ShowNoteAlone)
{
extern const char *Txt_Send_comment;
@@ -1540,7 +1537,8 @@ static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod)
fprintf (Gbl.F.Out,"");
@@ -1986,7 +1988,6 @@ static void Soc_ReceiveComment (void)
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
char Query[128+Cns_MAX_BYTES_LONG_TEXT];
struct SocialNote SocNot;
- char ParamName[32];
long ComCod;
/***** Get and store new comment *****/
@@ -1994,8 +1995,7 @@ static void Soc_ReceiveComment (void)
SocNot.NotCod = Soc_GetParamNotCod ();
/* Get the content of the comment */
- sprintf (ParamName,"Comment%ld",SocNot.NotCod);
- Par_GetParAndChangeFormat (ParamName,Content,Cns_MAX_BYTES_LONG_TEXT,
+ Par_GetParAndChangeFormat ("Comment",Content,Cns_MAX_BYTES_LONG_TEXT,
Str_TO_RIGOROUS_HTML,true);
if (Content[0])