mirror of https://github.com/acanas/swad-core.git
Version 15.123.5
This commit is contained in:
parent
7143b666f5
commit
3bfeef7d70
|
@ -121,13 +121,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.123.4 (2016-01-22)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.123.5 (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.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)
|
||||
Version 15.123.2: Jan 22, 2016 New social notifications. Not finished. (194279 lines)
|
||||
|
|
|
@ -10627,10 +10627,10 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char *Path)
|
|||
Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
|
||||
|
||||
/***** Set possible notifications as removed.
|
||||
Set possible social note as removed.
|
||||
Set possible social note as unavailable.
|
||||
Important: do this before removing from files *****/
|
||||
Ntf_MarkNotifOneFileAsRemoved (Path);
|
||||
Soc_MarkSocialNoteOneFileAsRemoved (Path);
|
||||
Soc_MarkSocialNoteOneFileAsUnavailable (Path);
|
||||
|
||||
/***** Remove from database the entries that store the marks properties *****/
|
||||
if (FileBrowser == Brw_ADMI_MARKS_CRS ||
|
||||
|
|
|
@ -2843,22 +2843,23 @@ static void Msg_ShowASentOrReceivedMessage (Msg_TypeOfMessages_t TypeOfMessages,
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Show brief subject of a message *********************/
|
||||
/******************** Get subject and content of a message *******************/
|
||||
/*****************************************************************************/
|
||||
// This function may be called inside a web service, so don't report error
|
||||
|
||||
void Msg_GetNotifMessage (char *SummaryStr,char **ContentStr,long MsgCod,unsigned MaxChars,bool GetContent)
|
||||
void Msg_GetNotifMessage (char *SummaryStr,char **ContentStr,long MsgCod,
|
||||
unsigned MaxChars,bool GetContent)
|
||||
{
|
||||
extern const char *Txt_MSG_Subject;
|
||||
char Query[512];
|
||||
char Query[128];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
SummaryStr[0] = '\0'; // Return nothing on error
|
||||
|
||||
/***** Get subject of message from database *****/
|
||||
sprintf (Query,"SELECT Subject,Content FROM msg_content"
|
||||
" WHERE MsgCod='%ld'",MsgCod);
|
||||
sprintf (Query,"SELECT Subject,Content FROM msg_content WHERE MsgCod='%ld'",
|
||||
MsgCod);
|
||||
if (!mysql_query (&Gbl.mysql,Query))
|
||||
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL)
|
||||
{
|
||||
|
|
|
@ -95,7 +95,8 @@ void Msg_GetDistinctCoursesInMyMessages (Msg_TypeOfMessages_t TypeOfMessages);
|
|||
void Msg_ShowFormSelectCourseSentOrRecMsgs (Msg_TypeOfMessages_t TypeOfMessages);
|
||||
void Msg_ShowFormToFilterMsgs (Msg_TypeOfMessages_t TypeOfMessages);
|
||||
void Msg_GetMsgSubject (long MsgCod,char *Subject);
|
||||
void Msg_GetNotifMessage (char *SummaryStr,char **ContentStr,long MsgCod,unsigned MaxChars,bool GetContent);
|
||||
void Msg_GetNotifMessage (char *SummaryStr,char **ContentStr,long MsgCod,
|
||||
unsigned MaxChars,bool GetContent);
|
||||
|
||||
void Msg_WriteMsgNumber (unsigned long MsgNum,bool NewMsg);
|
||||
void Msg_WriteMsgAuthor (struct UsrData *UsrDat,
|
||||
|
|
|
@ -585,7 +585,8 @@ void Ntf_ShowMyNotifications (void)
|
|||
{
|
||||
ContentStr = NULL;
|
||||
Ntf_GetNotifSummaryAndContent (SummaryStr,&ContentStr,NotifyEvent,
|
||||
Cod,Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,Cfg_MAX_CHARS_NOTIF_SUMMARY_SWAD,false);
|
||||
Cod,Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Cfg_MAX_CHARS_NOTIF_SUMMARY_SWAD,false);
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td colspan=\"2\"></td>"
|
||||
"<td colspan=\"5\" class=\"DAT LEFT_TOP\""
|
||||
|
@ -801,8 +802,10 @@ Ntf_StatusTxt_t Ntf_GetStatusTxtFromStatusBits (Ntf_Status_t Status)
|
|||
/******************* Get notification summary and content ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr,Ntf_NotifyEvent_t NotifyEvent,
|
||||
long Cod,long CrsCod,long UsrCod,unsigned MaxChars,bool GetContent)
|
||||
void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr,
|
||||
Ntf_NotifyEvent_t NotifyEvent,
|
||||
long Cod,long CrsCod,long UsrCod,
|
||||
unsigned MaxChars,bool GetContent)
|
||||
{
|
||||
SummaryStr[0] = '\0';
|
||||
|
||||
|
@ -831,6 +834,7 @@ void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr,Ntf_Notif
|
|||
Enr_GetNotifEnrollmentRequest (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
|
||||
break;
|
||||
case Ntf_EVENT_SOCIAL_POST:
|
||||
Soc_GetNotifNewSocialPost (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
|
||||
break;
|
||||
case Ntf_EVENT_SOCIAL_COMMENT:
|
||||
break;
|
||||
|
|
|
@ -102,8 +102,10 @@ typedef enum
|
|||
|
||||
void Ntf_ShowMyNotifications (void);
|
||||
Ntf_StatusTxt_t Ntf_GetStatusTxtFromStatusBits (Ntf_Status_t Status);
|
||||
void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr,Ntf_NotifyEvent_t NotifyEvent,
|
||||
long Cod,long CrsCod,long UsrCod,unsigned MaxChars,bool GetContent);
|
||||
void Ntf_GetNotifSummaryAndContent (char *SummaryStr,char **ContentStr,
|
||||
Ntf_NotifyEvent_t NotifyEvent,
|
||||
long Cod,long CrsCod,long UsrCod,
|
||||
unsigned MaxChars,bool GetContent);
|
||||
void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,long ToUsrCod);
|
||||
void Ntf_MarkNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod);
|
||||
void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod);
|
||||
|
|
|
@ -1686,10 +1686,10 @@ void Soc_MarkSocialNoteAsUnavailableUsingNoteTypeAndCod (Soc_NoteType_t NoteType
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Mark possible notifications of one file as removed **************/
|
||||
/************** Mark social notes of one file as unavailable *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Soc_MarkSocialNoteOneFileAsRemoved (const char *Path)
|
||||
void Soc_MarkSocialNoteOneFileAsUnavailable (const char *Path)
|
||||
{
|
||||
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
||||
Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
|
||||
|
@ -4185,3 +4185,46 @@ static void Soc_AddNotesJustRetrievedToTimelineThisSession (void)
|
|||
Gbl.Session.Id);
|
||||
DB_QueryREPLACE (Query,"can not insert social notes in timeline");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Get notification of a new social post *******************/
|
||||
/*****************************************************************************/
|
||||
// This function may be called inside a web service, so don't report error
|
||||
|
||||
void Soc_GetNotifNewSocialPost (char *SummaryStr,char **ContentStr,long PstCod,
|
||||
unsigned MaxChars,bool GetContent)
|
||||
{
|
||||
char Query[128];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
char Content[Cns_MAX_BYTES_LONG_TEXT+1];
|
||||
|
||||
SummaryStr[0] = '\0'; // Return nothing on error
|
||||
|
||||
/***** Get social post from database *****/
|
||||
sprintf (Query,"SELECT Content FROM social_posts WHERE PstCod='%ld'",
|
||||
PstCod);
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the content of a social post") == 1) // Result should have a unique row
|
||||
{
|
||||
/***** Get row *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/****** Get content (row[0]) *****/
|
||||
strncpy (Content,row[0],Cns_MAX_BYTES_LONG_TEXT);
|
||||
Content[Cns_MAX_BYTES_LONG_TEXT] = '\0';
|
||||
}
|
||||
else
|
||||
Content[0] = '\0';
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
|
||||
/***** Copy content string *****/
|
||||
if (GetContent)
|
||||
if ((*ContentStr = (char *) malloc (strlen (Content)+1)) != NULL)
|
||||
strcpy (*ContentStr,Content);
|
||||
|
||||
/***** Copy summary string *****/
|
||||
Str_LimitLengthHTMLStr (Content,MaxChars);
|
||||
strcpy (SummaryStr,Content);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ void Soc_RefreshOldTimelineUsr (void);
|
|||
long Soc_StoreAndPublishSocialNote (Soc_NoteType_t NoteType,long Cod);
|
||||
void Soc_MarkSocialNoteAsUnavailableUsingNotCod (long NotCod);
|
||||
void Soc_MarkSocialNoteAsUnavailableUsingNoteTypeAndCod (Soc_NoteType_t NoteType,long Cod);
|
||||
void Soc_MarkSocialNoteOneFileAsRemoved (const char *Path);
|
||||
void Soc_MarkSocialNoteOneFileAsUnavailable (const char *Path);
|
||||
void Soc_MarkSocialNotesChildrenOfFolderAsUnavailable (const char *Path);
|
||||
|
||||
void Soc_ReceiveSocialPostGbl (void);
|
||||
|
@ -139,4 +139,7 @@ void Soc_RemoveUsrSocialContent (long UsrCod);
|
|||
|
||||
void Soc_ClearOldTimelinesDB (void);
|
||||
|
||||
void Soc_GetNotifNewSocialPost (char *SummaryStr,char **ContentStr,long PstCod,
|
||||
unsigned MaxChars,bool GetContent);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2676,7 +2676,8 @@ int swad__getNotifications (struct soap *soap,
|
|||
/* Get summary and content */
|
||||
ContentStr = NULL;
|
||||
Ntf_GetNotifSummaryAndContent (SummaryStr,&ContentStr,NotifyEvent,
|
||||
Cod,Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,Cfg_MAX_CHARS_NOTIF_SUMMARY_WEB_SERVICE,true);
|
||||
Cod,Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Cfg_MAX_CHARS_NOTIF_SUMMARY_WEB_SERVICE,true);
|
||||
|
||||
getNotificationsOut->notificationsArray.__ptr[NumRow].summary = (char *) soap_malloc (Gbl.soap,strlen (SummaryStr)+1);
|
||||
strcpy (getNotificationsOut->notificationsArray.__ptr[NumRow].summary,SummaryStr);
|
||||
|
|
Loading…
Reference in New Issue