Version 15.123.6

This commit is contained in:
Antonio Cañas Vargas 2016-01-22 12:42:43 +01:00
parent 3bfeef7d70
commit b4c410deda
4 changed files with 34 additions and 18 deletions

View File

@ -121,13 +121,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.123.5 (2016-01-22)"
#define Log_PLATFORM_VERSION "SWAD 15.123.6 (2016-01-22)"
#define CSS_FILE "swad15.121.7.css"
#define JS_FILE "swad15.121.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.123.6: Jan 22, 2016 New social notifications. Not finished. (194342 lines)
Version 15.123.5: Jan 22, 2016 New social notifications. Not finished. (194328 lines)
Version 15.123.4: Jan 22, 2016 New social notifications. Not finished. (194281 lines)
Version 15.123.3: Jan 22, 2016 New social notifications. Not finished. (194280 lines)

View File

@ -720,6 +720,13 @@ static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
Brw_PutHiddenParamFilCod (FileMetadata.FilCod);
}
break;
case Ntf_EVENT_SOCIAL_POST:
case Ntf_EVENT_SOCIAL_COMMENT:
case Ntf_EVENT_SOCIAL_FAV:
case Ntf_EVENT_SOCIAL_SHARE:
Act_FormStart (ActSeeSocTmlGbl);
Soc_PutHiddenParamNotCod (Cod); // TODO: For future display of selected social note at top
break;
case Ntf_EVENT_FOLLOWER:
UsrDat.UsrCod = Cod; // Cod is the follower's code
Usr_GetEncryptedUsrCodFromUsrCod (&UsrDat);
@ -1087,8 +1094,8 @@ void Ntf_MarkNotifFilesInGroupAsRemoved (long GrpCod)
}
/*****************************************************************************/
/***** Get a list with user's codes of all users in current course/group ****/
/***** who wants to be notified by e-mail about an event, and notify them ****/
/********** Get a list with user's codes of all users to be notified *********/
/********** about an event, and notify them *********/
/*****************************************************************************/
// Return the number of users notified by e-mail
@ -1191,6 +1198,10 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
Gbl.Usrs.Me.UsrDat.UsrCod);
break;
case Ntf_EVENT_SOCIAL_POST:
// Get all my followers
sprintf (Query,"SELECT FollowerCod FROM usr_follow"
" WHERE FollowedCod='%ld'",
Gbl.Usrs.Me.UsrDat.UsrCod);
break;
case Ntf_EVENT_SOCIAL_COMMENT:
break;
@ -1544,6 +1555,10 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
switch (NotifyEvent)
{
case Ntf_EVENT_UNKNOWN:
case Ntf_EVENT_SOCIAL_POST:
case Ntf_EVENT_SOCIAL_COMMENT:
case Ntf_EVENT_SOCIAL_FAV:
case Ntf_EVENT_SOCIAL_SHARE:
case Ntf_EVENT_FOLLOWER:
break;
case Ntf_EVENT_DOCUMENT_FILE:
@ -1562,14 +1577,6 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsign
Txt_Course_NO_HTML[ToUsrLanguage],
Crs.FullName);
break;
case Ntf_EVENT_SOCIAL_POST:
break;
case Ntf_EVENT_SOCIAL_COMMENT:
break;
case Ntf_EVENT_SOCIAL_FAV:
break;
case Ntf_EVENT_SOCIAL_SHARE:
break;
case Ntf_EVENT_FORUM_POST_COURSE:
case Ntf_EVENT_FORUM_REPLY:
For_SetForumName (ForumType,

View File

@ -37,6 +37,7 @@
#include "swad_global.h"
#include "swad_layout.h"
#include "swad_notice.h"
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_profile.h"
#include "swad_social.h"
@ -285,7 +286,6 @@ static void Soc_PutFormToUnfavSocialComment (long ComCod);
static void Soc_PutFormToRemoveSocialPublishing (long NotCod);
static void Soc_PutHiddenParamNotCod (long NotCod);
static void Soc_PutHiddenParamComCod (long ComCod);
static long Soc_GetParamNotCod (void);
static long Soc_GetParamComCod (void);
@ -1991,6 +1991,9 @@ static long Soc_ReceiveSocialPost (void)
/* Insert post in social notes */
NotCod = Soc_StoreAndPublishSocialNote (Soc_NOTE_SOCIAL_POST,PstCod);
/***** Notify by e-mail about the new notice *****/
Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_SOCIAL_POST,NotCod);
}
else
NotCod = -1L;
@ -2583,7 +2586,7 @@ static void Soc_PutFormToRemoveSocialPublishing (long NotCod)
/************** Put parameter with the code of a social note *****************/
/*****************************************************************************/
static void Soc_PutHiddenParamNotCod (long NotCod)
void Soc_PutHiddenParamNotCod (long NotCod)
{
Par_PutHiddenParamLong ("NotCod",NotCod);
}
@ -4191,10 +4194,10 @@ static void Soc_AddNotesJustRetrievedToTimelineThisSession (void)
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Soc_GetNotifNewSocialPost (char *SummaryStr,char **ContentStr,long PstCod,
void Soc_GetNotifNewSocialPost (char *SummaryStr,char **ContentStr,long NotCod,
unsigned MaxChars,bool GetContent)
{
char Query[128];
char Query[512];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
@ -4202,8 +4205,11 @@ void Soc_GetNotifNewSocialPost (char *SummaryStr,char **ContentStr,long PstCod,
SummaryStr[0] = '\0'; // Return nothing on error
/***** Get social post from database *****/
sprintf (Query,"SELECT Content FROM social_posts WHERE PstCod='%ld'",
PstCod);
sprintf (Query,"SELECT social_posts.Content FROM social_notes,social_posts"
" WHERE social_notes.NotCod='%ld'"
" AND social_notes.NoteType='%u' AND"
" AND social_notes.Cod=social_posts.PstCod",
NotCod,(unsigned) Soc_NOTE_SOCIAL_POST);
if (DB_QuerySELECT (Query,&mysql_res,"can not get the content of a social post") == 1) // Result should have a unique row
{
/***** Get row *****/

View File

@ -108,6 +108,8 @@ void Soc_MarkSocialNotesChildrenOfFolderAsUnavailable (const char *Path);
void Soc_ReceiveSocialPostGbl (void);
void Soc_ReceiveSocialPostUsr (void);
void Soc_PutHiddenParamNotCod (long NotCod);
void Soc_ReceiveCommentGbl (void);
void Soc_ReceiveCommentUsr (void);
@ -139,7 +141,7 @@ void Soc_RemoveUsrSocialContent (long UsrCod);
void Soc_ClearOldTimelinesDB (void);
void Soc_GetNotifNewSocialPost (char *SummaryStr,char **ContentStr,long PstCod,
void Soc_GetNotifNewSocialPost (char *SummaryStr,char **ContentStr,long NotCod,
unsigned MaxChars,bool GetContent);
#endif