mirror of https://github.com/acanas/swad-core.git
Version 21.54.7: Nov 09, 2021 Queries moved from API module to database modules.
This commit is contained in:
parent
bf6028913d
commit
1dd26f6a4a
10
swad_API.c
10
swad_API.c
|
@ -3249,15 +3249,7 @@ int swad__markNotificationsAsRead (struct soap *soap,
|
||||||
if ((NtfCod = Str_ConvertStrCodToLongCod (LongStr)) > 0)
|
if ((NtfCod = Str_ConvertStrCodToLongCod (LongStr)) > 0)
|
||||||
{
|
{
|
||||||
/***** Mark notification as read in the database *****/
|
/***** Mark notification as read in the database *****/
|
||||||
DB_QueryUPDATE ("can not mark notification as read",
|
Ntf_DB_MarkNotifAsSeenUsingNtfCod (NtfCod);
|
||||||
"UPDATE ntf_notifications"
|
|
||||||
" SET Status=(Status | %u)"
|
|
||||||
" WHERE NtfCod=%ld"
|
|
||||||
" AND ToUsrCod=%ld",
|
|
||||||
(unsigned) Ntf_STATUS_BIT_READ,
|
|
||||||
(long) NtfCod,
|
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
||||||
|
|
||||||
NumNtfsMarkedAsRead++;
|
NumNtfsMarkedAsRead++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,7 +522,7 @@ static void Asg_ShowOneAssignment (struct Asg_Assignments *Assignments,
|
||||||
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd;
|
||||||
|
|
||||||
/***** Mark possible notification as seen *****/
|
/***** Mark possible notification as seen *****/
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_ASSIGNMENT,AsgCod);
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_ASSIGNMENT,AsgCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -8163,25 +8163,25 @@ void Brw_ShowFileMetadata (void)
|
||||||
case Brw_SHOW_DOC_GRP:
|
case Brw_SHOW_DOC_GRP:
|
||||||
case Brw_ADMI_DOC_CRS:
|
case Brw_ADMI_DOC_CRS:
|
||||||
case Brw_ADMI_DOC_GRP:
|
case Brw_ADMI_DOC_GRP:
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_DOCUMENT_FILE,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_DOCUMENT_FILE,
|
||||||
FileMetadata.FilCod);
|
FileMetadata.FilCod);
|
||||||
break;
|
break;
|
||||||
case Brw_ADMI_TCH_CRS:
|
case Brw_ADMI_TCH_CRS:
|
||||||
case Brw_ADMI_TCH_GRP:
|
case Brw_ADMI_TCH_GRP:
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_TEACHERS_FILE,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_TEACHERS_FILE,
|
||||||
FileMetadata.FilCod);
|
FileMetadata.FilCod);
|
||||||
break;
|
break;
|
||||||
case Brw_ADMI_SHR_CRS:
|
case Brw_ADMI_SHR_CRS:
|
||||||
case Brw_ADMI_SHR_GRP:
|
case Brw_ADMI_SHR_GRP:
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_SHARED_FILE,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_SHARED_FILE,
|
||||||
FileMetadata.FilCod);
|
FileMetadata.FilCod);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_MRK_CRS:
|
case Brw_SHOW_MRK_CRS:
|
||||||
case Brw_SHOW_MRK_GRP:
|
case Brw_SHOW_MRK_GRP:
|
||||||
case Brw_ADMI_MRK_CRS:
|
case Brw_ADMI_MRK_CRS:
|
||||||
case Brw_ADMI_MRK_GRP:
|
case Brw_ADMI_MRK_GRP:
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_MARKS_FILE,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_MARKS_FILE,
|
||||||
FileMetadata.FilCod);
|
FileMetadata.FilCod);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -8309,25 +8309,25 @@ void Brw_DownloadFile (void)
|
||||||
case Brw_SHOW_DOC_GRP:
|
case Brw_SHOW_DOC_GRP:
|
||||||
case Brw_ADMI_DOC_CRS:
|
case Brw_ADMI_DOC_CRS:
|
||||||
case Brw_ADMI_DOC_GRP:
|
case Brw_ADMI_DOC_GRP:
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_DOCUMENT_FILE,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_DOCUMENT_FILE,
|
||||||
FileMetadata.FilCod);
|
FileMetadata.FilCod);
|
||||||
break;
|
break;
|
||||||
case Brw_ADMI_TCH_CRS:
|
case Brw_ADMI_TCH_CRS:
|
||||||
case Brw_ADMI_TCH_GRP:
|
case Brw_ADMI_TCH_GRP:
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_TEACHERS_FILE,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_TEACHERS_FILE,
|
||||||
FileMetadata.FilCod);
|
FileMetadata.FilCod);
|
||||||
break;
|
break;
|
||||||
case Brw_ADMI_SHR_CRS:
|
case Brw_ADMI_SHR_CRS:
|
||||||
case Brw_ADMI_SHR_GRP:
|
case Brw_ADMI_SHR_GRP:
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_SHARED_FILE,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_SHARED_FILE,
|
||||||
FileMetadata.FilCod);
|
FileMetadata.FilCod);
|
||||||
break;
|
break;
|
||||||
case Brw_SHOW_MRK_CRS:
|
case Brw_SHOW_MRK_CRS:
|
||||||
case Brw_SHOW_MRK_GRP:
|
case Brw_SHOW_MRK_GRP:
|
||||||
case Brw_ADMI_MRK_CRS:
|
case Brw_ADMI_MRK_CRS:
|
||||||
case Brw_ADMI_MRK_GRP:
|
case Brw_ADMI_MRK_GRP:
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_MARKS_FILE,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_MARKS_FILE,
|
||||||
FileMetadata.FilCod);
|
FileMetadata.FilCod);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -551,7 +551,7 @@ void Cfe_ListCallsForExamsSee (void)
|
||||||
Cfe_ListCallsForExams (&CallsForExams,Cfe_NORMAL_VIEW);
|
Cfe_ListCallsForExams (&CallsForExams,Cfe_NORMAL_VIEW);
|
||||||
|
|
||||||
/***** Mark possible notifications as seen *****/
|
/***** Mark possible notifications as seen *****/
|
||||||
Ntf_DB_MarkNotifsInCrsAsSeenByMe (Ntf_EVENT_CALL_FOR_EXAM);
|
Ntf_DB_MarkNotifsInCrsAsSeen (Ntf_EVENT_CALL_FOR_EXAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
||||||
|
|
||||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 21.54.6 (2021-11-09)"
|
#define Log_PLATFORM_VERSION "SWAD 21.54.7 (2021-11-09)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.69.1.js"
|
#define JS_FILE "swad20.69.1.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 21.54.7: Nov 09, 2021 Queries moved from API module to database modules. (322175 lines)
|
||||||
Version 21.54.6: Nov 09, 2021 Code refactoring in notifications. (322164 lines)
|
Version 21.54.6: Nov 09, 2021 Code refactoring in notifications. (322164 lines)
|
||||||
Version 21.54.5: Nov 09, 2021 Queries moved from API module to database modules. (322185 lines)
|
Version 21.54.5: Nov 09, 2021 Queries moved from API module to database modules. (322185 lines)
|
||||||
Version 21.54.4: Nov 09, 2021 Queries moved from API module to database modules. (322222 lines)
|
Version 21.54.4: Nov 09, 2021 Queries moved from API module to database modules. (322222 lines)
|
||||||
|
|
|
@ -457,7 +457,7 @@ void Enr_ReqAcceptRegisterInCrs (void)
|
||||||
Err_WrongRoleExit ();
|
Err_WrongRoleExit ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Ntf_DB_MarkNotifsInCrsAsSeenByMe (NotifyEvent);
|
Ntf_DB_MarkNotifsInCrsAsSeen (NotifyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -2341,7 +2341,8 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
|
||||||
HTM_TR_End ();
|
HTM_TR_End ();
|
||||||
|
|
||||||
/***** Mark possible notification as seen *****/
|
/***** Mark possible notification as seen *****/
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_ENROLMENT_REQUEST,ReqCod);
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_ENROLMENT_REQUEST,
|
||||||
|
ReqCod);
|
||||||
}
|
}
|
||||||
else // User does not exists or user already belongs to course ==> remove pair from crs_requests table
|
else // User does not exists or user already belongs to course ==> remove pair from crs_requests table
|
||||||
Enr_RemUsrEnrolmentRequestInCrs (UsrDat.UsrCod,Crs.CrsCod);
|
Enr_RemUsrEnrolmentRequestInCrs (UsrDat.UsrCod,Crs.CrsCod);
|
||||||
|
|
|
@ -781,15 +781,15 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
|
||||||
{
|
{
|
||||||
case For_FORUM_COURSE_TCHS:
|
case For_FORUM_COURSE_TCHS:
|
||||||
case For_FORUM_COURSE_USRS:
|
case For_FORUM_COURSE_USRS:
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_FORUM_POST_COURSE,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_FORUM_POST_COURSE,
|
||||||
Forums->PstCod);
|
Forums->PstCod);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (Thread.NumMyPosts)
|
if (Thread.NumMyPosts)
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_FORUM_REPLY,
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_FORUM_REPLY,
|
||||||
Forums->PstCod);
|
Forums->PstCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** End table *****/
|
/***** End table *****/
|
||||||
|
|
|
@ -1211,7 +1211,7 @@ void Msg_ExpRecMsg (void)
|
||||||
Msg_DB_ExpandRcvMsg (Messages.ExpandedMsgCod);
|
Msg_DB_ExpandRcvMsg (Messages.ExpandedMsgCod);
|
||||||
|
|
||||||
/***** Mark possible notification as seen *****/
|
/***** Mark possible notification as seen *****/
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_MESSAGE,Messages.ExpandedMsgCod);
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_MESSAGE,Messages.ExpandedMsgCod);
|
||||||
|
|
||||||
/***** Show again the messages *****/
|
/***** Show again the messages *****/
|
||||||
Msg_ShowRecMsgs ();
|
Msg_ShowRecMsgs ();
|
||||||
|
|
|
@ -431,7 +431,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
/***** Mark possible notification as seen *****/
|
/***** Mark possible notification as seen *****/
|
||||||
Ntf_DB_MarkNotifsInCrsAsSeenByMe (Ntf_EVENT_NOTICE);
|
Ntf_DB_MarkNotifsInCrsAsSeen (Ntf_EVENT_NOTICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -125,7 +125,23 @@ void Ntf_DB_MarkPendingNtfsAsSent (long ToUsrCod)
|
||||||
/**************** Set one possible notification as seen by me ****************/
|
/**************** Set one possible notification as seen by me ****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Ntf_DB_MarkNotifAsSeenByMe (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
void Ntf_DB_MarkNotifAsSeenUsingNtfCod (long NtfCod)
|
||||||
|
{
|
||||||
|
DB_QueryUPDATE ("can not set notification as seen",
|
||||||
|
"UPDATE ntf_notifications"
|
||||||
|
" SET Status=(Status | %u)"
|
||||||
|
" WHERE NtfCod=%ld"
|
||||||
|
" AND ToUsrCod=%ld",
|
||||||
|
(unsigned) Ntf_STATUS_BIT_READ,
|
||||||
|
NtfCod,
|
||||||
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Set one possible notification as seen by me ****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||||
{
|
{
|
||||||
/***** Trivial check: if no code specified, nothing to do *****/
|
/***** Trivial check: if no code specified, nothing to do *****/
|
||||||
if (Cod <= 0) // If the user code is specified
|
if (Cod <= 0) // If the user code is specified
|
||||||
|
@ -148,7 +164,7 @@ void Ntf_DB_MarkNotifAsSeenByMe (Ntf_NotifyEvent_t NotifyEvent,long Cod)
|
||||||
/** Set all notifications of this type in the current course as seen by me ***/
|
/** Set all notifications of this type in the current course as seen by me ***/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Ntf_DB_MarkNotifsInCrsAsSeenByMe (Ntf_NotifyEvent_t NotifyEvent)
|
void Ntf_DB_MarkNotifsInCrsAsSeen (Ntf_NotifyEvent_t NotifyEvent)
|
||||||
{
|
{
|
||||||
DB_QueryUPDATE ("can not set notification(s) as seen",
|
DB_QueryUPDATE ("can not set notification(s) as seen",
|
||||||
"UPDATE ntf_notifications"
|
"UPDATE ntf_notifications"
|
||||||
|
|
|
@ -48,8 +48,9 @@ void Ntf_DB_StoreNotifyEventToUsr (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
void Ntf_DB_UpdateMyLastAccessToNotifications (void);
|
void Ntf_DB_UpdateMyLastAccessToNotifications (void);
|
||||||
void Ntf_DB_MarkAllMyNotifAsSeen (void);
|
void Ntf_DB_MarkAllMyNotifAsSeen (void);
|
||||||
void Ntf_DB_MarkPendingNtfsAsSent (long ToUsrCod);
|
void Ntf_DB_MarkPendingNtfsAsSent (long ToUsrCod);
|
||||||
void Ntf_DB_MarkNotifAsSeenByMe (Ntf_NotifyEvent_t NotifyEvent,long Cod);
|
void Ntf_DB_MarkNotifAsSeenUsingNtfCod (long NtfCod);
|
||||||
void Ntf_DB_MarkNotifsInCrsAsSeenByMe (Ntf_NotifyEvent_t NotifyEvent);
|
void Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_NotifyEvent_t NotifyEvent,long Cod);
|
||||||
|
void Ntf_DB_MarkNotifsInCrsAsSeen (Ntf_NotifyEvent_t NotifyEvent);
|
||||||
void Ntf_DB_MarkNotifsAsSeen (Ntf_NotifyEvent_t NotifyEvent);
|
void Ntf_DB_MarkNotifsAsSeen (Ntf_NotifyEvent_t NotifyEvent);
|
||||||
void Ntf_DB_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod);
|
void Ntf_DB_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod);
|
||||||
void Ntf_DB_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod);
|
void Ntf_DB_MarkNotifInCrsAsRemoved (long ToUsrCod,long CrsCod);
|
||||||
|
|
|
@ -280,7 +280,8 @@ void Prf_GetUsrDatAndShowUserProfile (void)
|
||||||
|
|
||||||
/***** If it's not me, mark possible notification as seen *****/
|
/***** If it's not me, mark possible notification as seen *****/
|
||||||
if (!Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod)) // Not me
|
if (!Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod)) // Not me
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_FOLLOWER,Gbl.Usrs.Other.UsrDat.UsrCod);
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_FOLLOWER,
|
||||||
|
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -702,7 +702,7 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
|
||||||
|
|
||||||
/***** Mark possible notification as seen *****/
|
/***** Mark possible notification as seen *****/
|
||||||
if (Svy.Scope == HieLvl_CRS) // Only course surveys are notified
|
if (Svy.Scope == HieLvl_CRS) // Only course surveys are notified
|
||||||
Ntf_DB_MarkNotifAsSeenByMe (Ntf_EVENT_SURVEY,Svy.Cod);
|
Ntf_DB_MarkNotifAsSeenUsingCod (Ntf_EVENT_SURVEY,Svy.Cod);
|
||||||
|
|
||||||
if (ShowOnlyThisSvyComplete)
|
if (ShowOnlyThisSvyComplete)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue