Version 16.148

This commit is contained in:
Antonio Cañas Vargas 2017-03-06 13:01:16 +01:00
parent a47496b456
commit 3f1dd125fb
28 changed files with 145 additions and 140 deletions

View File

@ -830,8 +830,9 @@ static void Asg_GetAssignmentTxtFromDB (long AsgCod,char Txt[Cns_MAX_BYTES_TEXT
/*****************************************************************************/
// This function may be called inside a web service
void Asg_GetNotifAssignment (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char **ContentStr,
long AsgCod,unsigned MaxChars,bool GetContent)
void Asg_GetNotifAssignment (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long AsgCod,bool GetContent)
{
char Query[512];
MYSQL_RES *mysql_res;
@ -854,9 +855,7 @@ void Asg_GetNotifAssignment (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char **Cont
/***** Get summary *****/
Str_Copy (SummaryStr,row[0],
Cns_MAX_BYTES_TEXT);
if (MaxChars)
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
Cns_MAX_BYTES_SUMMARY_STRING);
/***** Get content *****/
if (GetContent)

View File

@ -75,8 +75,9 @@ void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg);
void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg);
void Asg_FreeListAssignments (void);
void Asg_GetNotifAssignment (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char **ContentStr,
long AsgCod,unsigned MaxChars,bool GetContent);
void Asg_GetNotifAssignment (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long AsgCod,bool GetContent);
long Asg_GetParamAsgCod (void);
void Asg_ReqRemAssignment (void);

View File

@ -193,17 +193,23 @@
// TODO: System admin should view link "Visits to course"
// TODO: Un administrador de institución, ¿debería poder cambiar la contraseña de un usuario de esa institución? No lo tengo claro.
// TODO: Subject in forum_post should be VARCHAR(255) in order to be copied directly to SummaryStr
// TODO: Add a Subject (VARCHAR(255)) to notices to be used as SummaryStr
// TODO: Subject in msg_content and msg_content_deleted should be VARCHAR(255) in order to be copied directly to SummaryStr
// TODO: Check how to get a summary of a social post or comments
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.147.11 (2017-03-06)"
#define Log_PLATFORM_VERSION "SWAD 16.148 (2017-03-06)"
#define CSS_FILE "swad16.147.css"
#define JS_FILE "swad16.144.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 16.148: Mar 06, 2017 Code refactoring in notifications. (216393 lines)
Version 16.147.11:Mar 06, 2017 Changes in names of zipped files. (216388 lines)
Version 16.147.10:Mar 06, 2017 Changes in layout of users' listing. (216394 lines)
Version 16.147.9: Mar 06, 2017 Changes in layout of header. (216389 lines)

View File

@ -268,10 +268,6 @@
/* Courses */
#define Cfg_MIN_NUM_COURSES_TO_CONFIRM_SHOW_BIG_LIST 500 // If the number of courses in a list is greater than this, ask me for confirmation before showing the list
/* Notifications */
#define Cfg_MAX_CHARS_NOTIF_SUMMARY_SWAD 50
#define Cfg_MAX_CHARS_NOTIF_SUMMARY_WEB_SERVICE 100
/*****************************************************************************/
/*********************** Directories, folder and files ***********************/
/*****************************************************************************/

View File

@ -43,6 +43,8 @@
#define Cns_MAX_LENGTH_SUBJECT (256 - 1)
#define Cns_MAX_BYTES_SUBJECT (Cns_MAX_LENGTH_SUBJECT * Str_MAX_CHARACTER)
#define Cns_MAX_BYTES_SUMMARY_STRING (256 - 1)
#define Cns_MAX_BYTES_TEXT ( 64 * 1024 - 1) // Used for subjects and other medium texts
#define Cns_MAX_BYTES_LONG_TEXT (256 * 1024 - 1) // Used for big contents

View File

@ -385,9 +385,8 @@ void Enr_ReqAcceptRegisterInCrs (void)
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Enr_GetNotifEnrollment (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
long CrsCod,long UsrCod,
unsigned MaxChars)
void Enr_GetNotifEnrollment (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
long CrsCod,long UsrCod)
{
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
char Query[256];
@ -423,9 +422,7 @@ void Enr_GetNotifEnrollment (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
/* Role (row[0]) */
Role = Rol_ConvertUnsignedStrToRole (row[0]);
Str_Copy (SummaryStr,Txt_ROLES_SINGUL_Abc[Role][UsrDat.Sex],
Cns_MAX_BYTES_TEXT);
if (MaxChars)
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
Cns_MAX_BYTES_SUMMARY_STRING);
/* Free memory used for user's data */
Usr_UsrDataDestructor (&UsrDat);
@ -1948,8 +1945,9 @@ void Enr_SignUpInCrs (void)
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Enr_GetNotifEnrollmentRequest (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char **ContentStr,
long ReqCod,unsigned MaxChars,bool GetContent)
void Enr_GetNotifEnrollmentRequest (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long ReqCod,bool GetContent)
{
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
char Query[256];
@ -1985,9 +1983,7 @@ void Enr_GetNotifEnrollmentRequest (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char
/* Role (row[1]) */
DesiredRole = Rol_ConvertUnsignedStrToRole (row[1]);
Str_Copy (SummaryStr,Txt_ROLES_SINGUL_Abc[DesiredRole][UsrDat.Sex],
Cns_MAX_BYTES_TEXT);
if (MaxChars)
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
Cns_MAX_BYTES_SUMMARY_STRING);
if (GetContent)
if ((*ContentStr = (char *) malloc (256)))

View File

@ -81,9 +81,8 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole,
void Enr_WriteFormToReqAnotherUsrID (Act_Action_t NextAction);
void Enr_ReqAcceptRegisterInCrs (void);
void Enr_GetNotifEnrollment (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
long CrsCod,long UsrCod,
unsigned MaxChars);
void Enr_GetNotifEnrollment (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
long CrsCod,long UsrCod);
void Enr_UpdateUsrData (struct UsrData *UsrDat);
void Enr_FilterUsrDat (struct UsrData *UsrDat);
void Enr_UpdateInstitutionCentreDepartment (void);
@ -106,8 +105,9 @@ void Enr_RemAllStdsThisCrs (void);
unsigned Enr_RemAllStdsInCrs (struct Course *Crs);
void Enr_ReqSignUpInCrs (void);
void Enr_SignUpInCrs (void);
void Enr_GetNotifEnrollmentRequest (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char **ContentStr,
long ReqCod,unsigned MaxChars,bool GetContent);
void Enr_GetNotifEnrollmentRequest (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long ReqCod,bool GetContent);
void Enr_AskIfRejectSignUp (void);
void Enr_RejectSignUp (void);
void Enr_ShowEnrollmentRequests (void);

View File

@ -1605,14 +1605,13 @@ static long Exa_GetParamExaCod (void)
/*****************************************************************************/
/************ Get summary and content about an exam announcement *************/
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
// MaxChars must be > 3 + (2 + Cns_MAX_LENGTH_DATE + 6)
void Exa_GetSummaryAndContentExamAnnouncement (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void Exa_GetSummaryAndContentExamAnnouncement (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long ExaCod,unsigned MaxChars,bool GetContent)
long ExaCod,bool GetContent)
{
extern const char *Txt_hours_ABBREVIATION;
char CrsNameAndDate[Crs_MAX_LENGTH_COURSE_FULL_NAME + (2 + Cns_MAX_LENGTH_DATE + 6) + 1];
/***** Initializations *****/
Gbl.ExamAnns.ExaDat.ExaCod = ExaCod;
@ -1629,19 +1628,16 @@ void Exa_GetSummaryAndContentExamAnnouncement (char SummaryStr[Cns_MAX_BYTES_TEX
Exa_GetNotifContentExamAnnouncement (ContentStr);
/***** Summary *****/
/* Name of the course */
if (MaxChars)
Str_LimitLengthHTMLStr (Gbl.ExamAnns.ExaDat.CrsFullName,
MaxChars - (2 + Cns_MAX_LENGTH_DATE + 6));
/* Date of exam */
sprintf (SummaryStr,"%s, %04u-%02u-%02u %2u:%02u",
/* Name of the course and date of exam */
sprintf (CrsNameAndDate,"%s, %04u-%02u-%02u %2u:%02u",
Gbl.ExamAnns.ExaDat.CrsFullName,
Gbl.ExamAnns.ExaDat.ExamDate.Year,
Gbl.ExamAnns.ExaDat.ExamDate.Month,
Gbl.ExamAnns.ExaDat.ExamDate.Day,
Gbl.ExamAnns.ExaDat.StartTime.Hour,
Gbl.ExamAnns.ExaDat.StartTime.Minute);
Str_Copy (SummaryStr,CrsNameAndDate,
Cns_MAX_BYTES_SUMMARY_STRING);
/***** Free memory of the exam announcement *****/
Exa_FreeMemExamAnnouncement ();

View File

@ -99,8 +99,8 @@ void Exa_GetDateToHighlight (void);
void Exa_CreateListDatesOfExamAnnouncements (void);
void Exa_PutHiddenParamExaCod (long ExaCod);
void Exa_GetSummaryAndContentExamAnnouncement (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void Exa_GetSummaryAndContentExamAnnouncement (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long ExaCod,unsigned MaxChars,bool GetContent);
long ExaCod,bool GetContent);
#endif

View File

@ -11141,8 +11141,9 @@ void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat,Cns_QuietOrVerbose_t Qu
#define Brw_MAX_BYTES_FILE_CONTENT_STR (100 + NAME_MAX + 100 + PATH_MAX + 100 + (Usr_MAX_BYTES_NAME + 1) * 3 + 100 + Fil_MAX_BYTES_FILE_SIZE_STRING)
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char **ContentStr,
long FilCod,unsigned MaxChars,bool GetContent)
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long FilCod,bool GetContent)
{
extern const char *Txt_Filename;
extern const char *Txt_Folder;
@ -11163,9 +11164,7 @@ void Brw_GetSummaryAndContentOfFile (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],cha
/***** Copy file name into summary string *****/
Str_Copy (SummaryStr,FileMetadata.FilFolLnkName,
Cns_MAX_BYTES_TEXT);
if (MaxChars)
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
Cns_MAX_BYTES_SUMMARY_STRING);
/***** Copy some file metadata into content string *****/
if (GetContent && ContentStr)

View File

@ -247,8 +247,9 @@ void Brw_RemoveGrpZones (long CrsCod,long GrpCod);
void Brw_RemoveUsrWorksInCrs (struct UsrData *UsrDat,struct Course *Crs,Cns_QuietOrVerbose_t QuietOrVerbose);
void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat,Cns_QuietOrVerbose_t QuietOrVerbose);
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],char **ContentStr,
long FilCod,unsigned MaxChars,bool GetContent);
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long FilCod,bool GetContent);
unsigned Brw_ListDocsFound (const char *Query,
const char *TitleSingular,const char *TitlePlural);

View File

@ -1176,10 +1176,10 @@ void Fol_GetAndShowRankingFollowers (void)
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Fol_GetNotifFollower (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void Fol_GetNotifFollower (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr)
{
SummaryStr[0] = '\0';
SummaryStr[0] = '\0'; // Return nothing on error
if ((*ContentStr = (char *) malloc (1)))
*ContentStr[0] = '\0';

View File

@ -63,7 +63,7 @@ void Fol_UnfollowUsr2 (void);
void Fol_GetAndShowRankingFollowers (void);
void Fol_GetNotifFollower (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void Fol_GetNotifFollower (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr);
void Fol_RemoveUsrFromUsrFollow (long UsrCod);

View File

@ -1401,10 +1401,9 @@ static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void For_GetSummaryAndContentForumPst (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void For_GetSummaryAndContentForumPst (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long PstCod,
unsigned MaxChars,bool GetContent)
long PstCod,bool GetContent)
{
char Query[512];
MYSQL_RES *mysql_res;
@ -1426,10 +1425,16 @@ void For_GetSummaryAndContentForumPst (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
row = mysql_fetch_row (mysql_res);
/***** Copy subject *****/
Str_Copy (SummaryStr,row[0],
Cns_MAX_BYTES_TEXT);
if (MaxChars)
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
// TODO: Do only direct copy when Subject will be VARCHAR(255)
if (strlen (row[0]) > Cns_MAX_BYTES_SUMMARY_STRING)
{
strncpy (SummaryStr,row[0],
Cns_MAX_BYTES_SUMMARY_STRING);
SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING] = '\0';
}
else
Str_Copy (SummaryStr,row[0],
Cns_MAX_BYTES_SUMMARY_STRING);
/***** Copy content *****/
if (GetContent)

View File

@ -101,10 +101,9 @@ unsigned long For_GetNumPostsUsr (long UsrCod);
void For_DeleteThrFromReadThrs (long ThrCod);
void For_RemoveUsrFromReadThrs (long UsrCod);
void For_GetSummaryAndContentForumPst (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void For_GetSummaryAndContentForumPst (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long PstCod,
unsigned MaxChars,bool GetContent);
long PstCod,bool GetContent);
void For_PutAllHiddenParamsForum (void);
void For_SetForumTypeAndRestrictAccess (void);

View File

@ -709,10 +709,9 @@ void Mrk_ShowMyMarks (void)
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long MrkCod,long UsrCod,
unsigned MaxChars,bool GetContent)
long MrkCod,long UsrCod,bool GetContent)
{
char Query[512];
MYSQL_RES *mysql_res;
@ -783,8 +782,6 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
FileName);
Str_Copy (SummaryStr,FileName,
Cns_MAX_BYTES_TEXT);
if (MaxChars)
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
if (GetContent)
{

View File

@ -52,9 +52,8 @@ void Mrk_ChangeNumRowsFooter (void);
bool Mrk_CheckFileOfMarks (const char *Path,struct MarksProperties *Marks);
void Mrk_ShowMyMarks (void);
void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void Mrk_GetNotifMyMarks (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long MrkCod,long UsrCod,
unsigned MaxChars,bool GetContent);
long MrkCod,long UsrCod,bool GetContent);
#endif

View File

@ -3004,9 +3004,8 @@ static void Msg_ShowASentOrReceivedMessage (long MsgNum,long MsgCod)
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Msg_GetNotifMessage (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
char **ContentStr,long MsgCod,
unsigned MaxChars,bool GetContent)
void Msg_GetNotifMessage (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,long MsgCod,bool GetContent)
{
extern const char *Txt_MSG_Subject;
char Query[128];
@ -3029,10 +3028,16 @@ void Msg_GetNotifMessage (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
row = mysql_fetch_row (mysql_res);
/***** Copy subject *****/
Str_Copy (SummaryStr,row[0],
Cns_MAX_BYTES_TEXT);
if (MaxChars)
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
// TODO: Do only direct copy when Subject will be VARCHAR(255)
if (strlen (row[0]) > Cns_MAX_BYTES_SUMMARY_STRING)
{
strncpy (SummaryStr,row[0],
Cns_MAX_BYTES_SUMMARY_STRING);
SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING] = '\0';
}
else
Str_Copy (SummaryStr,row[0],
Cns_MAX_BYTES_SUMMARY_STRING);
/***** Copy subject *****/
if (GetContent)

View File

@ -94,9 +94,8 @@ void Msg_GetDistinctCoursesInMyMessages (void);
void Msg_ShowFormSelectCourseSentOrRecMsgs (void);
void Msg_ShowFormToFilterMsgs (void);
void Msg_GetMsgSubject (long MsgCod,char Subject[Cns_MAX_BYTES_SUBJECT + 1]);
void Msg_GetNotifMessage (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
char **ContentStr,long MsgCod,
unsigned MaxChars,bool GetContent);
void Msg_GetNotifMessage (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,long MsgCod,bool GetContent);
void Msg_WriteMsgNumber (unsigned long MsgNum,bool NewMsg);
void Msg_WriteMsgAuthor (struct UsrData *UsrDat,

View File

@ -745,9 +745,9 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Not_GetSummaryAndContentNotice (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
char **ContentStr,long NotCod,
unsigned MaxChars,bool GetContent)
void Not_GetSummaryAndContentNotice (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long NotCod,bool GetContent)
{
char Query[512];
MYSQL_RES *mysql_res;
@ -769,10 +769,16 @@ void Not_GetSummaryAndContentNotice (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
row = mysql_fetch_row (mysql_res);
/***** Copy summary *****/
Str_Copy (SummaryStr,row[0],
Cns_MAX_BYTES_TEXT);
if (MaxChars)
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
// TODO: Do only direct copy when a Subject of type VARCHAR(255) is available
if (strlen (row[0]) > Cns_MAX_BYTES_SUMMARY_STRING)
{
strncpy (SummaryStr,row[0],
Cns_MAX_BYTES_SUMMARY_STRING);
SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING] = '\0';
}
else
Str_Copy (SummaryStr,row[0],
Cns_MAX_BYTES_SUMMARY_STRING);
/***** Copy content *****/
if (GetContent)

View File

@ -68,9 +68,9 @@ void Not_RemoveNotice (void);
void Not_GetNotCodToHighlight (void);
void Not_ShowNotices (Not_Listing_t TypeNoticesListing);
void Not_GetSummaryAndContentNotice (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
char **ContentStr,long NotCod,
unsigned MaxChars,bool GetContent);
void Not_GetSummaryAndContentNotice (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long NotCod,bool GetContent);
unsigned Not_GetNumNotices (Sco_Scope_t Scope,Not_Status_t Status,unsigned *NumNotif);
unsigned Not_GetNumNoticesDeleted (Sco_Scope_t Scope,unsigned *NumNotif);

View File

@ -324,7 +324,7 @@ void Ntf_ShowMyNotifications (void)
time_t DateTimeUTC; // Date-time of the event
Ntf_Status_t Status;
Ntf_StatusTxt_t StatusTxt;
char SummaryStr[Cns_MAX_BYTES_TEXT + 1];
char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1];
char *ContentStr;
const char *ClassBackground;
const char *ClassAnchor;
@ -604,7 +604,7 @@ 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);
false);
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\"></td>"
"<td colspan=\"5\" class=\"DAT LEFT_TOP\""
@ -853,11 +853,11 @@ Ntf_StatusTxt_t Ntf_GetStatusTxtFromStatusBits (Ntf_Status_t Status)
/******************* Get notification summary and content ********************/
/*****************************************************************************/
void Ntf_GetNotifSummaryAndContent (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void Ntf_GetNotifSummaryAndContent (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
Ntf_NotifyEvent_t NotifyEvent,
long Cod,long CrsCod,long UsrCod,
unsigned MaxChars,bool GetContent)
bool GetContent)
{
SummaryStr[0] = '\0';
@ -868,49 +868,49 @@ void Ntf_GetNotifSummaryAndContent (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
case Ntf_EVENT_DOCUMENT_FILE:
case Ntf_EVENT_TEACHERS_FILE:
case Ntf_EVENT_SHARED_FILE:
Brw_GetSummaryAndContentOfFile (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
Brw_GetSummaryAndContentOfFile (SummaryStr,ContentStr,Cod,GetContent);
break;
case Ntf_EVENT_ASSIGNMENT:
Asg_GetNotifAssignment (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
Asg_GetNotifAssignment (SummaryStr,ContentStr,Cod,GetContent);
break;
case Ntf_EVENT_EXAM_ANNOUNCEMENT:
Exa_GetSummaryAndContentExamAnnouncement (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
Exa_GetSummaryAndContentExamAnnouncement (SummaryStr,ContentStr,Cod,GetContent);
break;
case Ntf_EVENT_MARKS_FILE:
Mrk_GetNotifMyMarks (SummaryStr,ContentStr,Cod,UsrCod,MaxChars,GetContent);
Mrk_GetNotifMyMarks (SummaryStr,ContentStr,Cod,UsrCod,GetContent);
break;
case Ntf_EVENT_ENROLLMENT_STUDENT:
case Ntf_EVENT_ENROLLMENT_TEACHER:
Enr_GetNotifEnrollment (SummaryStr,CrsCod,UsrCod,MaxChars);
Enr_GetNotifEnrollment (SummaryStr,CrsCod,UsrCod);
break;
case Ntf_EVENT_ENROLLMENT_REQUEST:
Enr_GetNotifEnrollmentRequest (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
Enr_GetNotifEnrollmentRequest (SummaryStr,ContentStr,Cod,GetContent);
break;
case Ntf_EVENT_TIMELINE_COMMENT:
case Ntf_EVENT_TIMELINE_FAV:
case Ntf_EVENT_TIMELINE_SHARE:
case Ntf_EVENT_TIMELINE_MENTION:
// Cod is the code of the social publishing
Soc_GetNotifSocialPublishing (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
Soc_GetNotifSocialPublishing (SummaryStr,ContentStr,Cod,GetContent);
break;
case Ntf_EVENT_FOLLOWER:
Fol_GetNotifFollower (SummaryStr,ContentStr);
break;
case Ntf_EVENT_FORUM_POST_COURSE:
case Ntf_EVENT_FORUM_REPLY:
For_GetSummaryAndContentForumPst (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
For_GetSummaryAndContentForumPst (SummaryStr,ContentStr,Cod,GetContent);
break;
case Ntf_EVENT_NOTICE:
Not_GetSummaryAndContentNotice (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
Not_GetSummaryAndContentNotice (SummaryStr,ContentStr,Cod,GetContent);
break;
case Ntf_EVENT_MESSAGE:
Msg_GetNotifMessage (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
Msg_GetNotifMessage (SummaryStr,ContentStr,Cod,GetContent);
if (Gbl.WebService.IsWebService)
/* Set the message as open by me, because I can read it in an extern application */
Msg_SetReceivedMsgAsOpen (Cod,UsrCod);
break;
case Ntf_EVENT_SURVEY:
Svy_GetNotifSurvey (SummaryStr,ContentStr,Cod,MaxChars,GetContent);
Svy_GetNotifSurvey (SummaryStr,ContentStr,Cod,GetContent);
break;
}
}

View File

@ -111,11 +111,11 @@ void Ntf_ShowMyNotifications (void);
Ntf_NotifyEvent_t Ntf_GetParamNotifyEvent (void);
Ntf_StatusTxt_t Ntf_GetStatusTxtFromStatusBits (Ntf_Status_t Status);
void Ntf_GetNotifSummaryAndContent (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
void Ntf_GetNotifSummaryAndContent (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
Ntf_NotifyEvent_t NotifyEvent,
long Cod,long CrsCod,long UsrCod,
unsigned MaxChars,bool GetContent);
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);

View File

@ -54,7 +54,6 @@
#define Soc_WIDTH_TIMELINE "560px"
#define Soc_MAX_SHARERS_FAVERS_SHOWN 7 // Maximum number of users shown who have share/fav a social note
#define Soc_MAX_BYTES_SUMMARY 1000
#define Soc_MAX_CHARS_IN_POST 1000
// Number of recent publishings got and shown the first time, before refreshing
@ -174,7 +173,7 @@ static void Soc_WriteDateTime (time_t TimeUTC);
static void Soc_GetAndWriteSocialPost (long PstCod);
static void Soc_PutFormGoToAction (const struct SocialNote *SocNot);
static void Soc_GetNoteSummary (const struct SocialNote *SocNot,
char SummaryStr[Cns_MAX_BYTES_TEXT + 1],unsigned MaxChars);
char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1]);
static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub);
static void Soc_PutFormToWriteNewPost (void);
@ -1264,7 +1263,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
bool ShowPhoto = false;
char PhotoURL[PATH_MAX + 1];
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
char SummaryStr[Cns_MAX_BYTES_TEXT + 1];
char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1];
unsigned NumComments;
char IdNewComment[Act_MAX_LENGTH_ID];
@ -1435,7 +1434,7 @@ static void Soc_WriteSocialNote (const struct SocialNote *SocNot,
}
/* Write note summary */
Soc_GetNoteSummary (SocNot,SummaryStr,Soc_MAX_BYTES_SUMMARY);
Soc_GetNoteSummary (SocNot,SummaryStr);
fprintf (Gbl.F.Out,"<div class=\"DAT\">%s</div>",SummaryStr);
}
@ -1872,7 +1871,7 @@ static void Soc_PutFormGoToAction (const struct SocialNote *SocNot)
/*****************************************************************************/
static void Soc_GetNoteSummary (const struct SocialNote *SocNot,
char SummaryStr[Cns_MAX_BYTES_TEXT + 1],unsigned MaxChars)
char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1])
{
SummaryStr[0] = '\0';
@ -1888,19 +1887,19 @@ static void Soc_GetNoteSummary (const struct SocialNote *SocNot,
case Soc_NOTE_DEG_SHA_PUB_FILE:
case Soc_NOTE_CRS_DOC_PUB_FILE:
case Soc_NOTE_CRS_SHA_PUB_FILE:
Brw_GetSummaryAndContentOfFile (SummaryStr,NULL,SocNot->Cod,MaxChars,false);
Brw_GetSummaryAndContentOfFile (SummaryStr,NULL,SocNot->Cod,false);
break;
case Soc_NOTE_EXAM_ANNOUNCEMENT:
Exa_GetSummaryAndContentExamAnnouncement (SummaryStr,NULL,SocNot->Cod,MaxChars,false);
Exa_GetSummaryAndContentExamAnnouncement (SummaryStr,NULL,SocNot->Cod,false);
break;
case Soc_NOTE_SOCIAL_POST:
// Not applicable
break;
case Soc_NOTE_FORUM_POST:
For_GetSummaryAndContentForumPst (SummaryStr,NULL,SocNot->Cod,MaxChars,false);
For_GetSummaryAndContentForumPst (SummaryStr,NULL,SocNot->Cod,false);
break;
case Soc_NOTE_NOTICE:
Not_GetSummaryAndContentNotice (SummaryStr,NULL,SocNot->Cod,MaxChars,false);
Not_GetSummaryAndContentNotice (SummaryStr,NULL,SocNot->Cod,false);
break;
}
}
@ -4733,9 +4732,9 @@ static void Soc_AddNotesJustRetrievedToTimelineThisSession (void)
/******************* Get notification of a new social post *******************/
/*****************************************************************************/
void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
char **ContentStr,long PubCod,
unsigned MaxChars,bool GetContent)
void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long PubCod,bool GetContent)
{
char Query[256];
MYSQL_RES *mysql_res;
@ -4748,7 +4747,7 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
/***** Return nothing on error *****/
SocPub.PubType = Soc_PUB_UNKNOWN;
SummaryStr[0] = '\0';
SummaryStr[0] = '\0'; // Return nothing on error
Content[0] = '\0';
/***** Get summary and content from social post from database *****/
@ -4809,12 +4808,12 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
}
/***** Copy summary string *****/
Str_LimitLengthHTMLStr (Content,MaxChars);
Str_LimitLengthHTMLStr (Content,Cns_MAX_BYTES_SUMMARY_STRING);
Str_Copy (SummaryStr,Content,
Cns_MAX_BYTES_TEXT);
Cns_MAX_BYTES_SUMMARY_STRING);
}
else
Soc_GetNoteSummary (&SocNot,SummaryStr,Soc_MAX_BYTES_SUMMARY);
Soc_GetNoteSummary (&SocNot,SummaryStr);
break;
case Soc_PUB_COMMENT_TO_NOTE:
/***** Get content of social post from database *****/
@ -4848,9 +4847,9 @@ void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
}
/***** Copy summary string *****/
Str_LimitLengthHTMLStr (Content,MaxChars);
Str_LimitLengthHTMLStr (Content,Cns_MAX_BYTES_SUMMARY_STRING);
Str_Copy (SummaryStr,Content,
Cns_MAX_BYTES_TEXT);
Cns_MAX_BYTES_SUMMARY_STRING);
break;
}

View File

@ -174,8 +174,8 @@ void Soc_RemoveUsrSocialContent (long UsrCod);
void Soc_ClearOldTimelinesDB (void);
void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
char **ContentStr,long PubCod,
unsigned MaxChars,bool GetContent);
void Soc_GetNotifSocialPublishing (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long PubCod,bool GetContent);
#endif

View File

@ -1400,8 +1400,9 @@ static void Svy_GetSurveyTxtFromDB (long SvyCod,char Txt[Cns_MAX_BYTES_TEXT + 1]
/*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Svy_GetNotifSurvey (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
char **ContentStr,long SvyCod,unsigned MaxChars,bool GetContent)
void Svy_GetNotifSurvey (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long SvyCod,bool GetContent)
{
char Query[512];
MYSQL_RES *mysql_res;
@ -1424,9 +1425,7 @@ void Svy_GetNotifSurvey (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
/***** Get summary *****/
Str_Copy (SummaryStr,row[0],
Cns_MAX_BYTES_TEXT);
if (MaxChars)
Str_LimitLengthHTMLStr (SummaryStr,MaxChars);
Cns_MAX_BYTES_SUMMARY_STRING);
/***** Get content *****/
if (GetContent)

View File

@ -94,8 +94,9 @@ void Svy_GetListSurveys (void);
void Svy_GetDataOfSurveyByCod (struct Survey *Svy);
void Svy_GetDataOfSurveyByFolder (struct Survey *Svy);
void Svy_FreeListSurveys (void);
void Svy_GetNotifSurvey (char SummaryStr[Cns_MAX_BYTES_TEXT + 1],
char **ContentStr,long SvyCod,unsigned MaxChars,bool GetContent);
void Svy_GetNotifSurvey (char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1],
char **ContentStr,
long SvyCod,bool GetContent);
void Svy_AskRemSurvey (void);
void Svy_RemoveSurvey (void);
void Svy_AskResetSurvey (void);

View File

@ -2815,7 +2815,7 @@ int swad__getNotifications (struct soap *soap,
struct Course Crs;
long Cod;
char ForumName[For_MAX_BYTES_FORUM_NAME + 1];
char SummaryStr[Cns_MAX_BYTES_TEXT + 1];
char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1];
char *ContentStr;
Ntf_Status_t Status;
size_t Length;
@ -2982,7 +2982,7 @@ int swad__getNotifications (struct soap *soap,
ContentStr = NULL;
Ntf_GetNotifSummaryAndContent (SummaryStr,&ContentStr,NotifyEvent,
Cod,Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod,
Cfg_MAX_CHARS_NOTIF_SUMMARY_WEB_SERVICE,true);
true);
Length = strlen (SummaryStr);
getNotificationsOut->notificationsArray.__ptr[NumNotif].summary = (char *) soap_malloc (Gbl.soap,Length + 1);
@ -4682,7 +4682,7 @@ int swad__getMarks (struct soap *soap,
{
int ReturnCode;
struct FileMetadata FileMetadata;
char SummaryStr[NAME_MAX + 1]; // Really not used
char SummaryStr[Cns_MAX_BYTES_SUMMARY_STRING + 1]; // Not used
char *ContentStr;
size_t Length;
@ -4747,9 +4747,9 @@ int swad__getMarks (struct soap *soap,
/***** Get content *****/
ContentStr = NULL;
Mrk_GetNotifMyMarks (SummaryStr,&ContentStr,
FileMetadata.FilCod,Gbl.Usrs.Me.UsrDat.UsrCod,
0,true);
Mrk_GetNotifMyMarks (SummaryStr, // Not used
&ContentStr,
FileMetadata.FilCod,Gbl.Usrs.Me.UsrDat.UsrCod,true);
if (ContentStr != NULL)
{
Length = strlen (ContentStr);