Version 20.43: Mar 04, 2021 Code refactoring in timeline.

This commit is contained in:
acanas 2021-03-04 17:47:08 +01:00
parent c36eb26162
commit fd83fc8087
38 changed files with 1433 additions and 1448 deletions

View File

@ -3519,7 +3519,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
{ {
border-top:1px solid silver; border-top:1px solid silver;
} }
.TL_TOP_CONT .Tml_TOP_CONT
{ {
box-sizing:border-box; box-sizing:border-box;
padding-top:10px; padding-top:10px;
@ -3528,7 +3528,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
overflow:hidden; overflow:hidden;
text-overflow:ellipsis; text-overflow:ellipsis;
} }
.TL_TOP_PUBLISHER .Tml_TOP_PUBLISHER
{ {
color:#808080; color:#808080;
font-size:13pt; font-size:13pt;
@ -3718,7 +3718,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
{ {
display:table-cell; display:table-cell;
} }
.TL_NUM_USRS .Tml_NUM_USRS
{ {
display:table-cell; display:table-cell;
color:#A0A0A0; color:#A0A0A0;

View File

@ -1114,7 +1114,7 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
UsrDat->UsrCod); UsrDat->UsrCod);
/***** Remove social content associated to the user *****/ /***** Remove social content associated to the user *****/
TL_Usr_RemoveUsrContent (UsrDat->UsrCod); Tml_Usr_RemoveUsrContent (UsrDat->UsrCod);
/***** Remove user's figures *****/ /***** Remove user's figures *****/
Prf_RemoveUsrFigures (UsrDat->UsrCod); Prf_RemoveUsrFigures (UsrDat->UsrCod);

View File

@ -128,7 +128,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
// TabStr ****************************************************************** // TabStr ******************************************************************
[ActFrmLogIn ] = {1521, 0,TabStr,ActFrmLogIn , 0,0x001,0x001,0x001,0x001,0x001,0x001,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WriteLandingPage ,"power-off" }, [ActFrmLogIn ] = {1521, 0,TabStr,ActFrmLogIn , 0,0x001,0x001,0x001,0x001,0x001,0x001,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_WriteLandingPage ,"power-off" },
[ActReqSch ] = { 627, 1,TabStr,ActReqSch ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Sch_ReqSysSearch ,"search" }, [ActReqSch ] = { 627, 1,TabStr,ActReqSch ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Sch_ReqSysSearch ,"search" },
[ActSeeGblTL ] = {1490, 2,TabStr,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,TL_Who_GetParamWho ,TL_ShowTimelineGbl ,"comment-dots" }, [ActSeeGblTL ] = {1490, 2,TabStr,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Tml_Who_GetParamWho ,Tml_ShowTimelineGbl ,"comment-dots" },
[ActSeeSocPrf ] = {1520, 3,TabStr,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_SeeSocialProfiles ,"user-circle" }, [ActSeeSocPrf ] = {1520, 3,TabStr,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_SeeSocialProfiles ,"user-circle" },
[ActSeeCal ] = {1622, 4,TabStr,ActSeeCal ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cal_ShowCalendar ,"calendar" }, [ActSeeCal ] = {1622, 4,TabStr,ActSeeCal ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cal_ShowCalendar ,"calendar" },
[ActSeeNtf ] = { 990, 5,TabStr,ActSeeNtf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Ntf_ShowMyNotifications ,"bell" }, [ActSeeNtf ] = { 990, 5,TabStr,ActSeeNtf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Ntf_ShowMyNotifications ,"bell" },
@ -143,44 +143,44 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActSch ] = { 628,-1,TabUnk,ActReqSch ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Sch_GetParamsSearch ,Sch_SysSearch ,NULL}, [ActSch ] = { 628,-1,TabUnk,ActReqSch ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,Sch_GetParamsSearch ,Sch_SysSearch ,NULL},
[ActRefNewPubGblTL ] = {1509,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_AJAX_RFRESH,TL_Who_GetParamWho ,TL_RefreshNewTimelineGbl ,NULL}, [ActRefNewPubGblTL ] = {1509,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_AJAX_RFRESH,Tml_Who_GetParamWho ,Tml_RefreshNewTimelineGbl ,NULL},
[ActRefOldPubGblTL ] = {1510,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,TL_Who_GetParamWho ,TL_RefreshOldTimelineGbl ,NULL}, [ActRefOldPubGblTL ] = {1510,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,Tml_Who_GetParamWho ,Tml_RefreshOldTimelineGbl ,NULL},
[ActRcvPstGblTL ] = {1492,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,TL_Who_GetParamWho ,TL_Pst_ReceivePostGbl ,NULL}, [ActRcvPstGblTL ] = {1492,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,Tml_Who_GetParamWho ,Tml_Pst_ReceivePostGbl ,NULL},
[ActRcvComGblTL ] = {1503,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,TL_Who_GetParamWho ,TL_Com_ReceiveCommGbl ,NULL}, [ActRcvComGblTL ] = {1503,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,Tml_Who_GetParamWho ,Tml_Com_ReceiveCommGbl ,NULL},
[ActShoHidComGblTL ] = {1806,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Com_ShowHiddenCommsGbl ,NULL}, [ActShoHidComGblTL ] = {1806,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Com_ShowHiddenCommsGbl ,NULL},
[ActAllShaNotGblTL ] = {1766,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Sha_ShowAllSharersNoteGbl ,NULL}, [ActAllShaNotGblTL ] = {1766,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Sha_ShowAllSharersNoteGbl ,NULL},
[ActAllFavNotGblTL ] = {1767,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_ShowAllFaversNoteGbl ,NULL}, [ActAllFavNotGblTL ] = {1767,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_ShowAllFaversNoteGbl ,NULL},
[ActAllFavComGblTL ] = {1768,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_ShowAllFaversComGbl ,NULL}, [ActAllFavComGblTL ] = {1768,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_ShowAllFaversComGbl ,NULL},
[ActShaNotGblTL ] = {1495,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Sha_ShaNoteGbl ,NULL}, [ActShaNotGblTL ] = {1495,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Sha_ShaNoteGbl ,NULL},
[ActUnsNotGblTL ] = {1496,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Sha_UnsNoteGbl ,NULL}, [ActUnsNotGblTL ] = {1496,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Sha_UnsNoteGbl ,NULL},
[ActFavNotGblTL ] = {1512,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_FavNoteGbl ,NULL}, [ActFavNotGblTL ] = {1512,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_FavNoteGbl ,NULL},
[ActUnfNotGblTL ] = {1513,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_UnfNoteGbl ,NULL}, [ActUnfNotGblTL ] = {1513,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_UnfNoteGbl ,NULL},
[ActFavComGblTL ] = {1516,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_FavCommGbl ,NULL}, [ActFavComGblTL ] = {1516,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_FavCommGbl ,NULL},
[ActUnfComGblTL ] = {1517,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_UnfCommGbl ,NULL}, [ActUnfComGblTL ] = {1517,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_UnfCommGbl ,NULL},
[ActReqRemPubGblTL ] = {1494,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,TL_Who_GetParamWho ,TL_Not_RequestRemNoteGbl ,NULL}, [ActReqRemPubGblTL ] = {1494,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Tml_Who_GetParamWho ,Tml_Not_RequestRemNoteGbl ,NULL},
[ActRemPubGblTL ] = {1493,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,TL_Who_GetParamWho ,TL_Not_RemoveNoteGbl ,NULL}, [ActRemPubGblTL ] = {1493,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Tml_Who_GetParamWho ,Tml_Not_RemoveNoteGbl ,NULL},
[ActReqRemComGblTL ] = {1505,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,TL_Who_GetParamWho ,TL_Com_RequestRemComGbl ,NULL}, [ActReqRemComGblTL ] = {1505,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Tml_Who_GetParamWho ,Tml_Com_RequestRemComGbl ,NULL},
[ActRemComGblTL ] = {1507,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,TL_Who_GetParamWho ,TL_Com_RemoveComGbl ,NULL}, [ActRemComGblTL ] = {1507,-1,TabUnk,ActSeeGblTL ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,Tml_Who_GetParamWho ,Tml_Com_RemoveComGbl ,NULL},
[ActReqOthPubPrf ] = {1401,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_RequestUserProfile ,NULL}, [ActReqOthPubPrf ] = {1401,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_RequestUserProfile ,NULL},
[ActRefOldPubUsrTL ] = {1511,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_RefreshOldTimelineUsr ,NULL}, [ActRefOldPubUsrTL ] = {1511,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_RefreshOldTimelineUsr ,NULL},
[ActRcvPstUsrTL ] = {1498,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,TL_Pst_ReceivePostUsr ,NULL}, [ActRcvPstUsrTL ] = {1498,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,Tml_Pst_ReceivePostUsr ,NULL},
[ActRcvComUsrTL ] = {1504,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,TL_Com_ReceiveCommUsr ,NULL}, [ActRcvComUsrTL ] = {1504,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_DATA,Act_BRW_1ST_TAB,NULL ,Tml_Com_ReceiveCommUsr ,NULL},
[ActShoHidComUsrTL ] = {1807,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Com_ShowHiddenCommsUsr ,NULL}, [ActShoHidComUsrTL ] = {1807,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Com_ShowHiddenCommsUsr ,NULL},
[ActAllShaNotUsrTL ] = {1769,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Sha_ShowAllSharersNoteUsr ,NULL}, [ActAllShaNotUsrTL ] = {1769,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Sha_ShowAllSharersNoteUsr ,NULL},
[ActAllFavNotUsrTL ] = {1770,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_ShowAllFaversNoteUsr ,NULL}, [ActAllFavNotUsrTL ] = {1770,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_ShowAllFaversNoteUsr ,NULL},
[ActAllFavComUsrTL ] = {1771,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_ShowAllFaversComUsr ,NULL}, [ActAllFavComUsrTL ] = {1771,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_ShowAllFaversComUsr ,NULL},
[ActShaNotUsrTL ] = {1499,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Sha_ShaNoteUsr ,NULL}, [ActShaNotUsrTL ] = {1499,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Sha_ShaNoteUsr ,NULL},
[ActUnsNotUsrTL ] = {1500,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Sha_UnsNoteUsr ,NULL}, [ActUnsNotUsrTL ] = {1500,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Sha_UnsNoteUsr ,NULL},
[ActFavNotUsrTL ] = {1514,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_FavNoteUsr ,NULL}, [ActFavNotUsrTL ] = {1514,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_FavNoteUsr ,NULL},
[ActUnfNotUsrTL ] = {1515,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_UnfNoteUsr ,NULL}, [ActUnfNotUsrTL ] = {1515,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_UnfNoteUsr ,NULL},
[ActFavComUsrTL ] = {1518,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_FavCommUsr ,NULL}, [ActFavComUsrTL ] = {1518,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_FavCommUsr ,NULL},
[ActUnfComUsrTL ] = {1519,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,TL_Fav_UnfCommUsr ,NULL}, [ActUnfComUsrTL ] = {1519,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_AJAX_NORMAL,NULL ,Tml_Fav_UnfCommUsr ,NULL},
[ActReqRemPubUsrTL ] = {1501,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TL_Not_RequestRemNoteUsr ,NULL}, [ActReqRemPubUsrTL ] = {1501,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tml_Not_RequestRemNoteUsr ,NULL},
[ActRemPubUsrTL ] = {1502,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TL_Not_RemoveNoteUsr ,NULL}, [ActRemPubUsrTL ] = {1502,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tml_Not_RemoveNoteUsr ,NULL},
[ActReqRemComUsrTL ] = {1506,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TL_Com_RequestRemComUsr ,NULL}, [ActReqRemComUsrTL ] = {1506,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tml_Com_RequestRemComUsr ,NULL},
[ActRemComUsrTL ] = {1508,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TL_Com_RemoveComUsr ,NULL}, [ActRemComUsrTL ] = {1508,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,0x3C6,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tml_Com_RemoveComUsr ,NULL},
[ActSeeOthPubPrf ] = {1402,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_GetUsrDatAndShowUserProfile,NULL}, [ActSeeOthPubPrf ] = {1402,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_GetUsrDatAndShowUserProfile,NULL},
[ActCalFig ] = {1405,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_CalculateFigures ,NULL}, [ActCalFig ] = {1405,-1,TabUnk,ActSeeSocPrf ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Prf_CalculateFigures ,NULL},

View File

@ -600,10 +600,11 @@ TODO: Salvador Romero Cort
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria. TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
*/ */
#define Log_PLATFORM_VERSION "SWAD 20.42 (2021-03-04)" #define Log_PLATFORM_VERSION "SWAD 20.43 (2021-03-04)"
#define CSS_FILE "swad20.33.9.css" #define CSS_FILE "swad20.33.9.css"
#define JS_FILE "swad20.6.2.js" #define JS_FILE "swad20.6.2.js"
/* /*
Version 20.43: Mar 04, 2021 Code refactoring in timeline. (305609 lines)
Version 20.42: Mar 04, 2021 Fixed bugs in GROUP BY, caused by upgrading MySQL 5 (order by default) to MySQL 8 (no order by default). (305624 lines) Version 20.42: Mar 04, 2021 Fixed bugs in GROUP BY, caused by upgrading MySQL 5 (order by default) to MySQL 8 (no order by default). (305624 lines)
3 change necessary in database: 3 change necessary in database:
DROP TABLE IF EXISTS crs_usr_backup_delete_me; DROP TABLE IF EXISTS crs_usr_backup_delete_me;

View File

@ -380,7 +380,7 @@ void ExaAnn_ReceiveExamAnn2 (void)
ExaAnn_UpdateNumUsrsNotifiedByEMailAboutExamAnn (ExamAnns->HighlightExaCod,NumUsrsToBeNotifiedByEMail); ExaAnn_UpdateNumUsrsNotifiedByEMailAboutExamAnn (ExamAnns->HighlightExaCod,NumUsrsToBeNotifiedByEMail);
/***** Create a new social note about the new exam announcement *****/ /***** Create a new social note about the new exam announcement *****/
TL_Not_StoreAndPublishNote (TL_NOTE_EXAM_ANNOUNCEMENT,ExamAnns->HighlightExaCod); Tml_Not_StoreAndPublishNote (TL_NOTE_EXAM_ANNOUNCEMENT,ExamAnns->HighlightExaCod);
/***** Update RSS of current course *****/ /***** Update RSS of current course *****/
RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs);
@ -498,7 +498,7 @@ void ExaAnn_RemoveExamAnn1 (void)
Ntf_MarkNotifAsRemoved (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExaCod); Ntf_MarkNotifAsRemoved (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExaCod);
/***** Mark possible social note as unavailable *****/ /***** Mark possible social note as unavailable *****/
TL_DB_MarkNoteAsUnavailable (TL_NOTE_EXAM_ANNOUNCEMENT,ExaCod); Tml_DB_MarkNoteAsUnavailable (TL_NOTE_EXAM_ANNOUNCEMENT,ExaCod);
/***** Update RSS of current course *****/ /***** Update RSS of current course *****/
RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs);

View File

@ -3381,7 +3381,7 @@ static void Fig_GetAndShowTimelineActivityStats (void)
extern const char *Txt_Total; extern const char *Txt_Total;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
TL_Not_NoteType_t NoteType; Tml_Not_NoteType_t NoteType;
unsigned long NumNotes; unsigned long NumNotes;
unsigned long NumRows; unsigned long NumRows;
unsigned NumUsrs; unsigned NumUsrs;
@ -3418,8 +3418,8 @@ static void Fig_GetAndShowTimelineActivityStats (void)
1 << Rol_TCH); 1 << Rol_TCH);
/***** Get total number of following/followers from database *****/ /***** Get total number of following/followers from database *****/
for (NoteType = (TL_Not_NoteType_t) 0; for (NoteType = (Tml_Not_NoteType_t) 0;
NoteType <= (TL_Not_NoteType_t) (TL_NOT_NUM_NOTE_TYPES - 1); NoteType <= (Tml_Not_NoteType_t) (TL_NOT_NUM_NOTE_TYPES - 1);
NoteType++) NoteType++)
{ {
switch (Gbl.Scope.Current) switch (Gbl.Scope.Current)

View File

@ -10154,28 +10154,28 @@ void Brw_ChgFileMetadata (void)
switch (Gbl.FileBrowser.Type) switch (Gbl.FileBrowser.Type)
{ {
case Brw_ADMI_DOC_INS: case Brw_ADMI_DOC_INS:
TL_Not_StoreAndPublishNote (TL_NOTE_INS_DOC_PUB_FILE,FileMetadata.FilCod); Tml_Not_StoreAndPublishNote (TL_NOTE_INS_DOC_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_SHR_INS: case Brw_ADMI_SHR_INS:
TL_Not_StoreAndPublishNote (TL_NOTE_INS_SHA_PUB_FILE,FileMetadata.FilCod); Tml_Not_StoreAndPublishNote (TL_NOTE_INS_SHA_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_DOC_CTR: case Brw_ADMI_DOC_CTR:
TL_Not_StoreAndPublishNote (TL_NOTE_CTR_DOC_PUB_FILE,FileMetadata.FilCod); Tml_Not_StoreAndPublishNote (TL_NOTE_CTR_DOC_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_SHR_CTR: case Brw_ADMI_SHR_CTR:
TL_Not_StoreAndPublishNote (TL_NOTE_CTR_SHA_PUB_FILE,FileMetadata.FilCod); Tml_Not_StoreAndPublishNote (TL_NOTE_CTR_SHA_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_DOC_DEG: case Brw_ADMI_DOC_DEG:
TL_Not_StoreAndPublishNote (TL_NOTE_DEG_DOC_PUB_FILE,FileMetadata.FilCod); Tml_Not_StoreAndPublishNote (TL_NOTE_DEG_DOC_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_SHR_DEG: case Brw_ADMI_SHR_DEG:
TL_Not_StoreAndPublishNote (TL_NOTE_DEG_SHA_PUB_FILE,FileMetadata.FilCod); Tml_Not_StoreAndPublishNote (TL_NOTE_DEG_SHA_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_DOC_CRS: case Brw_ADMI_DOC_CRS:
TL_Not_StoreAndPublishNote (TL_NOTE_CRS_DOC_PUB_FILE,FileMetadata.FilCod); Tml_Not_StoreAndPublishNote (TL_NOTE_CRS_DOC_PUB_FILE,FileMetadata.FilCod);
break; break;
case Brw_ADMI_SHR_CRS: case Brw_ADMI_SHR_CRS:
TL_Not_StoreAndPublishNote (TL_NOTE_CRS_SHA_PUB_FILE,FileMetadata.FilCod); Tml_Not_StoreAndPublishNote (TL_NOTE_CRS_SHA_PUB_FILE,FileMetadata.FilCod);
break; break;
default: default:
break; break;
@ -11076,7 +11076,7 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char Path[PATH_MAX + 1])
Set possible social note as unavailable. Set possible social note as unavailable.
Important: do this before removing from files *****/ Important: do this before removing from files *****/
Ntf_MarkNotifOneFileAsRemoved (Path); Ntf_MarkNotifOneFileAsRemoved (Path);
TL_Not_MarkNoteOneFileAsUnavailable (Path); Tml_Not_MarkNoteOneFileAsUnavailable (Path);
/***** Remove from database the entries that store the marks properties *****/ /***** Remove from database the entries that store the marks properties *****/
if (FileBrowser == Brw_ADMI_MRK_CRS || if (FileBrowser == Brw_ADMI_MRK_CRS ||
@ -11120,7 +11120,7 @@ static void Brw_RemoveChildrenOfFolderFromDB (const char Path[PATH_MAX + 1])
Set possible social notes as unavailable. Set possible social notes as unavailable.
Important: do this before removing from files *****/ Important: do this before removing from files *****/
Ntf_MarkNotifChildrenOfFolderAsRemoved (Path); Ntf_MarkNotifChildrenOfFolderAsRemoved (Path);
TL_Not_MarkNotesChildrenOfFolderAsUnavailable (Path); Tml_Not_MarkNotesChildrenOfFolderAsUnavailable (Path);
/***** Remove from database the entries that store the marks properties *****/ /***** Remove from database the entries that store the marks properties *****/
if (FileBrowser == Brw_ADMI_MRK_CRS || if (FileBrowser == Brw_ADMI_MRK_CRS ||

View File

@ -4006,7 +4006,7 @@ void For_ReceiveForumPost (void)
{ {
case For_FORUM_GLOBAL_USRS: case For_FORUM_GLOBAL_USRS:
case For_FORUM__SWAD__USRS: case For_FORUM__SWAD__USRS:
TL_Not_StoreAndPublishNote (TL_NOTE_FORUM_POST,PstCod); Tml_Not_StoreAndPublishNote (TL_NOTE_FORUM_POST,PstCod);
break; break;
default: default:
break; break;
@ -4094,7 +4094,7 @@ void For_RemovePost (void)
{ {
case For_FORUM_GLOBAL_USRS: case For_FORUM_GLOBAL_USRS:
case For_FORUM__SWAD__USRS: case For_FORUM__SWAD__USRS:
TL_DB_MarkNoteAsUnavailable (TL_NOTE_FORUM_POST,Forums.PstCod); Tml_DB_MarkNoteAsUnavailable (TL_NOTE_FORUM_POST,Forums.PstCod);
break; break;
default: default:
break; break;

View File

@ -891,7 +891,7 @@ static void Lay_WriteScriptParamsAJAX (void)
"var RefreshParamWho = \"Who=%u\";\n", "var RefreshParamWho = \"Who=%u\";\n",
Act_GetActCod (ActRefNewPubGblTL), Act_GetActCod (ActRefNewPubGblTL),
Act_GetActCod (ActRefOldPubGblTL), Act_GetActCod (ActRefOldPubGblTL),
(unsigned) TL_Who_GetGlobalWho ()); // Global variable got in a priori function (unsigned) Tml_Who_GetGlobalWho ()); // Global variable got in a priori function
break; break;
/* Parameters related with user timeline refreshing */ /* Parameters related with user timeline refreshing */
case ActSeeOthPubPrf: case ActSeeOthPubPrf:

View File

@ -156,7 +156,7 @@ void Not_ReceiveNotice (void)
Not_UpdateNumUsrsNotifiedByEMailAboutNotice (NotCod,NumUsrsToBeNotifiedByEMail); Not_UpdateNumUsrsNotifiedByEMailAboutNotice (NotCod,NumUsrsToBeNotifiedByEMail);
/***** Create a new social note about the new notice *****/ /***** Create a new social note about the new notice *****/
TL_Not_StoreAndPublishNote (TL_NOTE_NOTICE,NotCod); Tml_Not_StoreAndPublishNote (TL_NOTE_NOTICE,NotCod);
/***** Set notice to be highlighted *****/ /***** Set notice to be highlighted *****/
Gbl.Crs.Notices.HighlightNotCod = NotCod; Gbl.Crs.Notices.HighlightNotCod = NotCod;
@ -340,7 +340,7 @@ void Not_RemoveNotice (void)
Ntf_MarkNotifAsRemoved (Ntf_EVENT_NOTICE,NotCod); Ntf_MarkNotifAsRemoved (Ntf_EVENT_NOTICE,NotCod);
/***** Mark possible social note as unavailable *****/ /***** Mark possible social note as unavailable *****/
TL_DB_MarkNoteAsUnavailable (TL_NOTE_NOTICE,NotCod); Tml_DB_MarkNoteAsUnavailable (TL_NOTE_NOTICE,NotCod);
/***** Update RSS of current course *****/ /***** Update RSS of current course *****/
RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs);

View File

@ -725,7 +725,7 @@ static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
case Ntf_EVENT_TL_MENTION: case Ntf_EVENT_TL_MENTION:
// Cod is the code of the social publishing // Cod is the code of the social publishing
Frm_BeginForm (ActSeeGblTL); Frm_BeginForm (ActSeeGblTL);
TL_Pub_PutHiddenParamPubCod (Cod); Tml_Pub_PutHiddenParamPubCod (Cod);
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod); Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
Ntf_PutHiddenParamNotifyEvent (NotifyEvent); Ntf_PutHiddenParamNotifyEvent (NotifyEvent);
break; break;
@ -877,7 +877,7 @@ void Ntf_GetNotifSummaryAndContent (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
case Ntf_EVENT_TL_SHARE: case Ntf_EVENT_TL_SHARE:
case Ntf_EVENT_TL_MENTION: case Ntf_EVENT_TL_MENTION:
// Cod is the code of the social publishing // Cod is the code of the social publishing
TL_Ntf_GetNotifPublication (SummaryStr,ContentStr,Cod,GetContent); Tml_Ntf_GetNotifPublication (SummaryStr,ContentStr,Cod,GetContent);
break; break;
case Ntf_EVENT_FOLLOWER: case Ntf_EVENT_FOLLOWER:
Fol_GetNotifFollower (SummaryStr,ContentStr); Fol_GetNotifFollower (SummaryStr,ContentStr);

View File

@ -236,7 +236,7 @@ void Prf_RequestUserProfile (void)
void Prf_GetUsrDatAndShowUserProfile (void) void Prf_GetUsrDatAndShowUserProfile (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
bool ItsMe; bool ItsMe;
bool ProfileShown = false; bool ProfileShown = false;
@ -254,11 +254,11 @@ void Prf_GetUsrDatAndShowUserProfile (void)
if (Gbl.Usrs.Me.Logged) // Timeline visible only by logged users if (Gbl.Usrs.Me.Logged) // Timeline visible only by logged users
{ {
/* Reset timeline context */ /* Reset timeline context */
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/* Show timeline */ /* Show timeline */
HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID); HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID);
TL_ShowTimelineUsr (&Timeline); Tml_ShowTimelineUsr (&Timeline);
HTM_SECTION_End (); HTM_SECTION_End ();
} }
} }
@ -1127,7 +1127,7 @@ static void Prf_GetNumSocialPubsAndStoreAsUsrFigure (long UsrCod)
Prf_ResetUsrFigures (&UsrFigures); Prf_ResetUsrFigures (&UsrFigures);
/***** Get number of forum posts from database *****/ /***** Get number of forum posts from database *****/
UsrFigures.NumSocPub = TL_DB_GetNumPubsUsr (UsrCod); UsrFigures.NumSocPub = Tml_DB_GetNumPubsUsr (UsrCod);
/***** Update number of forum posts in user's figures *****/ /***** Update number of forum posts in user's figures *****/
if (Prf_CheckIfUsrFiguresExists (UsrCod)) if (Prf_CheckIfUsrFiguresExists (UsrCod))

View File

@ -227,7 +227,7 @@ static void Ses_RemoveSessionFromDB (void)
/***** Clear old unused social timelines in database *****/ /***** Clear old unused social timelines in database *****/
// This is necessary to prevent the table growing and growing // This is necessary to prevent the table growing and growing
TL_DB_ClearOldTimelinesNotesFromDB (); Tml_DB_ClearOldTimelinesNotesFromDB ();
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -52864,12 +52864,12 @@ const char *Txt_TIMELINE_NOTE[TL_NOT_NUM_NOTE_TYPES] =
#endif #endif
}; };
const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[TL_NUM_TOP_MESSAGES] = const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[Tml_NUM_TOP_MESSAGES] =
{ {
[TL_TOP_MESSAGE_NONE] = [Tml_TOP_MESSAGE_NONE] =
"" ""
, ,
[TL_TOP_MESSAGE_COMMENTED] = [Tml_TOP_MESSAGE_COMMENTED] =
#if L==1 // ca #if L==1 // ca
"ha comentat" "ha comentat"
#elif L==2 // de #elif L==2 // de
@ -52890,7 +52890,7 @@ const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[TL_NUM_TOP_MESSAGES] =
"comentou" "comentou"
#endif #endif
, ,
[TL_TOP_MESSAGE_FAVED] = [Tml_TOP_MESSAGE_FAVED] =
#if L==1 // ca #if L==1 // ca
"ha marcat com favorit" "ha marcat com favorit"
#elif L==2 // de #elif L==2 // de
@ -52911,7 +52911,7 @@ const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[TL_NUM_TOP_MESSAGES] =
"marcou como favorito" "marcou como favorito"
#endif #endif
, ,
[TL_TOP_MESSAGE_UNFAVED] = [Tml_TOP_MESSAGE_UNFAVED] =
#if L==1 // ca #if L==1 // ca
"ha desmarcat com favorit" "ha desmarcat com favorit"
#elif L==2 // de #elif L==2 // de
@ -52932,7 +52932,7 @@ const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[TL_NUM_TOP_MESSAGES] =
"desmarcou como favorito" "desmarcou como favorito"
#endif #endif
, ,
[TL_TOP_MESSAGE_SHARED] = [Tml_TOP_MESSAGE_SHARED] =
#if L==1 // ca #if L==1 // ca
"ha compartit" "ha compartit"
#elif L==2 // de #elif L==2 // de
@ -52953,7 +52953,7 @@ const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[TL_NUM_TOP_MESSAGES] =
"compartilhou" "compartilhou"
#endif #endif
, ,
[TL_TOP_MESSAGE_UNSHARED] = [Tml_TOP_MESSAGE_UNSHARED] =
#if L==1 // ca #if L==1 // ca
"ha deixat de compartir" "ha deixat de compartir"
#elif L==2 // de #elif L==2 // de
@ -52974,7 +52974,7 @@ const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[TL_NUM_TOP_MESSAGES] =
"parou compartilhar" "parou compartilhar"
#endif #endif
, ,
[TL_TOP_MESSAGE_MENTIONED] = [Tml_TOP_MESSAGE_MENTIONED] =
#if L==1 // ca #if L==1 // ca
"li ha esmentat" "li ha esmentat"
#elif L==2 // de #elif L==2 // de

View File

@ -162,41 +162,41 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_GetAndShowOldTimeline (struct TL_Timeline *Timeline); static void Tml_GetAndShowOldTimeline (struct Tml_Timeline *Timeline);
static void TL_ShowTimeline (struct TL_Timeline *Timeline, static void Tml_ShowTimeline (struct Tml_Timeline *Timeline,
long NotCodToHighlight,const char *Title); long NotCodToHighlight,const char *Title);
static void TL_PutIconsTimeline (__attribute__((unused)) void *Args); static void Tml_PutIconsTimeline (__attribute__((unused)) void *Args);
static unsigned TL_ListRecentPubs (struct TL_Timeline *Timeline, static unsigned Tml_ListRecentPubs (struct Tml_Timeline *Timeline,
long NotCodToHighlight); long NotCodToHighlight);
static void TL_PutHiddenList (const char *Id); static void Tml_PutHiddenList (const char *Id);
/*****************************************************************************/ /*****************************************************************************/
/************************ Initialize global timeline *************************/ /************************ Initialize global timeline *************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_InitTimelineGbl (struct TL_Timeline *Timeline) void Tml_InitTimelineGbl (struct Tml_Timeline *Timeline)
{ {
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (Timeline); Tml_ResetTimeline (Timeline);
/***** Mark all my notifications about timeline as seen *****/ /***** Mark all my notifications about timeline as seen *****/
TL_Ntf_MarkMyNotifAsSeen (); Tml_Ntf_MarkMyNotifAsSeen ();
/***** Get which users *****/ /***** Get which users *****/
Timeline->Who = TL_Who_GetGlobalWho (); Timeline->Who = Tml_Who_GetGlobalWho ();
} }
/*****************************************************************************/ /*****************************************************************************/
/*************************** Reset timeline context **************************/ /*************************** Reset timeline context **************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_ResetTimeline (struct TL_Timeline *Timeline) void Tml_ResetTimeline (struct Tml_Timeline *Timeline)
{ {
Timeline->UsrOrGbl = TL_Usr_TIMELINE_GBL; Timeline->UsrOrGbl = Tml_Usr_TIMELINE_GBL;
Timeline->Who = TL_Who_DEFAULT_WHO; Timeline->Who = Tml_Who_DEFAULT_WHO;
Timeline->WhatToGet = TL_GET_RECENT_TIMELINE; Timeline->WhatToGet = Tml_GET_RECENT_TIMELINE;
Timeline->Pubs.Top = Timeline->Pubs.Top =
Timeline->Pubs.Bottom = NULL, Timeline->Pubs.Bottom = NULL,
Timeline->NotCod = -1L; Timeline->NotCod = -1L;
@ -207,28 +207,28 @@ void TL_ResetTimeline (struct TL_Timeline *Timeline)
/**************** Show highlighted note and global timeline ******************/ /**************** Show highlighted note and global timeline ******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_ShowTimelineGbl (void) void Tml_ShowTimelineGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Initialize timeline *****/ /***** Initialize timeline *****/
TL_InitTimelineGbl (&Timeline); Tml_InitTimelineGbl (&Timeline);
/***** Save which users in database *****/ /***** Save which users in database *****/
TL_Who_SaveWhoInDB (&Timeline); Tml_Who_SaveWhoInDB (&Timeline);
/***** Show highlighted note and global timeline *****/ /***** Show highlighted note and global timeline *****/
TL_ShowNoteAndTimelineGbl (&Timeline); Tml_ShowNoteAndTimelineGbl (&Timeline);
} }
/*****************************************************************************/ /*****************************************************************************/
/**************** Show highlighted note and global timeline ******************/ /**************** Show highlighted note and global timeline ******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_ShowNoteAndTimelineGbl (struct TL_Timeline *Timeline) void Tml_ShowNoteAndTimelineGbl (struct Tml_Timeline *Timeline)
{ {
long PubCod; long PubCod;
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Initialize note code to -1 ==> no highlighted note *****/ /***** Initialize note code to -1 ==> no highlighted note *****/
Not.NotCod = -1L; Not.NotCod = -1L;
@ -236,98 +236,98 @@ void TL_ShowNoteAndTimelineGbl (struct TL_Timeline *Timeline)
/***** Get parameter with the code of a publication *****/ /***** Get parameter with the code of a publication *****/
// This parameter is optional. It can be provided by a notification. // This parameter is optional. It can be provided by a notification.
// If > 0 ==> the note is shown highlighted above the timeline // If > 0 ==> the note is shown highlighted above the timeline
PubCod = TL_Pub_GetParamPubCod (); PubCod = Tml_Pub_GetParamPubCod ();
/***** If a note should be highlighted ==> get code of note from database *****/ /***** If a note should be highlighted ==> get code of note from database *****/
if (PubCod > 0) if (PubCod > 0)
Not.NotCod = TL_DB_GetNotCodFromPubCod (PubCod); Not.NotCod = Tml_DB_GetNotCodFromPubCod (PubCod);
/***** If a note should be highlighted ==> show it above the timeline *****/ /***** If a note should be highlighted ==> show it above the timeline *****/
if (Not.NotCod > 0) if (Not.NotCod > 0)
TL_Not_ShowHighlightedNote (Timeline,&Not); Tml_Not_ShowHighlightedNote (Timeline,&Not);
/***** Show timeline with possible highlighted note *****/ /***** Show timeline with possible highlighted note *****/
TL_ShowTimelineGblHighlighting (Timeline,Not.NotCod); Tml_ShowTimelineGblHighlighting (Timeline,Not.NotCod);
} }
/*****************************************************************************/ /*****************************************************************************/
/******************* Show global timeline highlighting a note ****************/ /******************* Show global timeline highlighting a note ****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_ShowTimelineGblHighlighting (struct TL_Timeline *Timeline,long NotCod) void Tml_ShowTimelineGblHighlighting (struct Tml_Timeline *Timeline,long NotCod)
{ {
extern const char *Txt_Timeline; extern const char *Txt_Timeline;
/***** Get list of pubications to show in timeline *****/ /***** Get list of pubications to show in timeline *****/
Timeline->UsrOrGbl = TL_Usr_TIMELINE_GBL; Timeline->UsrOrGbl = Tml_Usr_TIMELINE_GBL;
Timeline->WhatToGet = TL_GET_RECENT_TIMELINE; Timeline->WhatToGet = Tml_GET_RECENT_TIMELINE;
TL_Pub_GetListPubsToShowInTimeline (Timeline); Tml_Pub_GetListPubsToShowInTimeline (Timeline);
/***** Show timeline *****/ /***** Show timeline *****/
TL_ShowTimeline (Timeline,NotCod,Txt_Timeline); Tml_ShowTimeline (Timeline,NotCod,Txt_Timeline);
/***** Free chained list of publications *****/ /***** Free chained list of publications *****/
TL_Pub_FreeListPubs (Timeline); Tml_Pub_FreeListPubs (Timeline);
} }
/*****************************************************************************/ /*****************************************************************************/
/********************* Show timeline of a selected user **********************/ /********************* Show timeline of a selected user **********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_ShowTimelineUsr (struct TL_Timeline *Timeline) void Tml_ShowTimelineUsr (struct Tml_Timeline *Timeline)
{ {
TL_ShowTimelineUsrHighlighting (Timeline,-1L); Tml_ShowTimelineUsrHighlighting (Timeline,-1L);
} }
/*****************************************************************************/ /*****************************************************************************/
/************ Show timeline of a selected user highlighting a note ***********/ /************ Show timeline of a selected user highlighting a note ***********/
/*****************************************************************************/ /*****************************************************************************/
void TL_ShowTimelineUsrHighlighting (struct TL_Timeline *Timeline,long NotCod) void Tml_ShowTimelineUsrHighlighting (struct Tml_Timeline *Timeline,long NotCod)
{ {
extern const char *Txt_Timeline_OF_A_USER; extern const char *Txt_Timeline_OF_A_USER;
/***** Get list of pubications to show in timeline *****/ /***** Get list of pubications to show in timeline *****/
Timeline->UsrOrGbl = TL_Usr_TIMELINE_USR; Timeline->UsrOrGbl = Tml_Usr_TIMELINE_USR;
Timeline->WhatToGet = TL_GET_RECENT_TIMELINE; Timeline->WhatToGet = Tml_GET_RECENT_TIMELINE;
TL_Pub_GetListPubsToShowInTimeline (Timeline); Tml_Pub_GetListPubsToShowInTimeline (Timeline);
/***** Show timeline *****/ /***** Show timeline *****/
TL_ShowTimeline (Timeline,NotCod, Tml_ShowTimeline (Timeline,NotCod,
Str_BuildStringStr (Txt_Timeline_OF_A_USER, Str_BuildStringStr (Txt_Timeline_OF_A_USER,
Gbl.Usrs.Other.UsrDat.FrstName)); Gbl.Usrs.Other.UsrDat.FrstName));
Str_FreeString (); Str_FreeString ();
/***** Free chained list of publications *****/ /***** Free chained list of publications *****/
TL_Pub_FreeListPubs (Timeline); Tml_Pub_FreeListPubs (Timeline);
} }
/*****************************************************************************/ /*****************************************************************************/
/************** Refresh new publications in timeline via AJAX ****************/ /************** Refresh new publications in timeline via AJAX ****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_RefreshNewTimelineGbl (void) void Tml_RefreshNewTimelineGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
if (Gbl.Session.IsOpen) // If session has been closed, do not write anything if (Gbl.Session.IsOpen) // If session has been closed, do not write anything
{ {
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** Get which users *****/ /***** Get which users *****/
Timeline.Who = TL_Who_GetGlobalWho (); Timeline.Who = Tml_Who_GetGlobalWho ();
/***** Get list of pubications to show in timeline *****/ /***** Get list of pubications to show in timeline *****/
Timeline.UsrOrGbl = TL_Usr_TIMELINE_GBL; Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL;
Timeline.WhatToGet = TL_GET_ONLY_NEW_PUBS; Timeline.WhatToGet = Tml_GET_ONLY_NEW_PUBS;
TL_Pub_GetListPubsToShowInTimeline (&Timeline); Tml_Pub_GetListPubsToShowInTimeline (&Timeline);
/***** Show new timeline *****/ /***** Show new timeline *****/
TL_Pub_InsertNewPubsInTimeline (&Timeline); Tml_Pub_InsertNewPubsInTimeline (&Timeline);
/***** Free chained list of publications *****/ /***** Free chained list of publications *****/
TL_Pub_FreeListPubs (&Timeline); Tml_Pub_FreeListPubs (&Timeline);
} }
} }
@ -335,36 +335,36 @@ void TL_RefreshNewTimelineGbl (void)
/**************** View old publications in timeline via AJAX *****************/ /**************** View old publications in timeline via AJAX *****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_RefreshOldTimelineGbl (void) void Tml_RefreshOldTimelineGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** Get which users *****/ /***** Get which users *****/
Timeline.Who = TL_Who_GetGlobalWho (); Timeline.Who = Tml_Who_GetGlobalWho ();
/***** Show old publications *****/ /***** Show old publications *****/
Timeline.UsrOrGbl = TL_Usr_TIMELINE_GBL; Timeline.UsrOrGbl = Tml_Usr_TIMELINE_GBL;
Timeline.WhatToGet = TL_GET_ONLY_OLD_PUBS; Timeline.WhatToGet = Tml_GET_ONLY_OLD_PUBS;
TL_GetAndShowOldTimeline (&Timeline); Tml_GetAndShowOldTimeline (&Timeline);
} }
void TL_RefreshOldTimelineUsr (void) void Tml_RefreshOldTimelineUsr (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // Existing user if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // Existing user
{ {
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** If user exists, show old publications *****/ /***** If user exists, show old publications *****/
Timeline.UsrOrGbl = TL_Usr_TIMELINE_USR; Timeline.UsrOrGbl = Tml_Usr_TIMELINE_USR;
Timeline.WhatToGet = TL_GET_ONLY_OLD_PUBS; Timeline.WhatToGet = Tml_GET_ONLY_OLD_PUBS;
TL_GetAndShowOldTimeline (&Timeline); Tml_GetAndShowOldTimeline (&Timeline);
} }
} }
@ -372,16 +372,16 @@ void TL_RefreshOldTimelineUsr (void)
/**************** Get and show old publications in timeline ******************/ /**************** Get and show old publications in timeline ******************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_GetAndShowOldTimeline (struct TL_Timeline *Timeline) static void Tml_GetAndShowOldTimeline (struct Tml_Timeline *Timeline)
{ {
/***** Get list of pubications to show in timeline *****/ /***** Get list of pubications to show in timeline *****/
TL_Pub_GetListPubsToShowInTimeline (Timeline); Tml_Pub_GetListPubsToShowInTimeline (Timeline);
/***** Show old timeline *****/ /***** Show old timeline *****/
TL_Pub_ShowOldPubsInTimeline (Timeline); Tml_Pub_ShowOldPubsInTimeline (Timeline);
/***** Free chained list of publications *****/ /***** Free chained list of publications *****/
TL_Pub_FreeListPubs (Timeline); Tml_Pub_FreeListPubs (Timeline);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -416,8 +416,8 @@ static void TL_GetAndShowOldTimeline (struct TL_Timeline *Timeline)
| |_____| | |_____|
\ |_____| \ |_____|
*/ */
static void TL_ShowTimeline (struct TL_Timeline *Timeline, static void Tml_ShowTimeline (struct Tml_Timeline *Timeline,
long NotCodToHighlight,const char *Title) long NotCodToHighlight,const char *Title)
{ {
extern const char *Hlp_START_Timeline; extern const char *Hlp_START_Timeline;
bool GlobalTimeline = (Gbl.Usrs.Other.UsrDat.UsrCod <= 0); bool GlobalTimeline = (Gbl.Usrs.Other.UsrDat.UsrCod <= 0);
@ -425,42 +425,42 @@ static void TL_ShowTimeline (struct TL_Timeline *Timeline,
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Title, Box_BoxBegin (NULL,Title,
TL_PutIconsTimeline,NULL, Tml_PutIconsTimeline,NULL,
Hlp_START_Timeline,Box_NOT_CLOSABLE); Hlp_START_Timeline,Box_NOT_CLOSABLE);
/***** Put form to select users whom public activity is displayed *****/ /***** Put form to select users whom public activity is displayed *****/
if (GlobalTimeline) if (GlobalTimeline)
TL_Who_PutFormWho (Timeline); Tml_Who_PutFormWho (Timeline);
/***** Form to write a new post *****/ /***** Form to write a new post *****/
if (GlobalTimeline || Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod)) if (GlobalTimeline || Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod))
TL_Pst_PutPhotoAndFormToWriteNewPost (Timeline); Tml_Pst_PutPhotoAndFormToWriteNewPost (Timeline);
/***** New publications refreshed dynamically via AJAX *****/ /***** New publications refreshed dynamically via AJAX *****/
if (GlobalTimeline) if (GlobalTimeline)
{ {
/* Link to view new publications via AJAX */ /* Link to view new publications via AJAX */
TL_Pub_PutLinkToViewNewPubs (); Tml_Pub_PutLinkToViewNewPubs ();
/* Hidden lists to insert publications received via AJAX: /* Hidden lists to insert publications received via AJAX:
1. just received (not visible) publications 1. just received (not visible) publications
2. new (not visible) publications */ 2. new (not visible) publications */
TL_PutHiddenList ("just_now_timeline_list"); Tml_PutHiddenList ("just_now_timeline_list");
TL_PutHiddenList ("new_timeline_list"); Tml_PutHiddenList ("new_timeline_list");
} }
/***** List recent publications in timeline *****/ /***** List recent publications in timeline *****/
NumNotesShown = TL_ListRecentPubs (Timeline,NotCodToHighlight); NumNotesShown = Tml_ListRecentPubs (Timeline,NotCodToHighlight);
/***** If the number of publications shown is the maximum, /***** If the number of publications shown is the maximum,
probably there will be more, so show link to get more *****/ probably there will be more, so show link to get more *****/
if (NumNotesShown == TL_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW) if (NumNotesShown == Tml_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW)
{ {
/* Link to view old publications via AJAX */ /* Link to view old publications via AJAX */
TL_Pub_PutLinkToViewOldPubs (); Tml_Pub_PutLinkToViewOldPubs ();
/* Hidden list to insert old publications via AJAX */ /* Hidden list to insert old publications via AJAX */
TL_PutHiddenList ("old_timeline_list"); Tml_PutHiddenList ("old_timeline_list");
} }
/***** End box *****/ /***** End box *****/
@ -471,7 +471,7 @@ static void TL_ShowTimeline (struct TL_Timeline *Timeline,
/********************* Put contextual icons in timeline **********************/ /********************* Put contextual icons in timeline **********************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_PutIconsTimeline (__attribute__((unused)) void *Args) static void Tml_PutIconsTimeline (__attribute__((unused)) void *Args)
{ {
/***** Put icon to show a figure *****/ /***** Put icon to show a figure *****/
Fig_PutIconToShowFigure (Fig_TIMELINE); Fig_PutIconToShowFigure (Fig_TIMELINE);
@ -482,12 +482,12 @@ static void TL_PutIconsTimeline (__attribute__((unused)) void *Args)
/*****************************************************************************/ /*****************************************************************************/
// Returns number of notes shown // Returns number of notes shown
static unsigned TL_ListRecentPubs (struct TL_Timeline *Timeline, static unsigned Tml_ListRecentPubs (struct Tml_Timeline *Timeline,
long NotCodToHighlight) long NotCodToHighlight)
{ {
unsigned NumNotesShown; unsigned NumNotesShown;
struct TL_Pub_Publication *Pub; struct Tml_Pub_Publication *Pub;
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Begin list *****/ /***** Begin list *****/
HTM_UL_Begin ("id=\"timeline_list\" class=\"TL_LIST\""); HTM_UL_Begin ("id=\"timeline_list\" class=\"TL_LIST\"");
@ -499,14 +499,14 @@ static unsigned TL_ListRecentPubs (struct TL_Timeline *Timeline,
{ {
/* Get data of note */ /* Get data of note */
Not.NotCod = Pub->NotCod; Not.NotCod = Pub->NotCod;
TL_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
/* Write list item (note) */ /* Write list item (note) */
HTM_LI_Begin ("class=\"%s\"", HTM_LI_Begin ("class=\"%s\"",
Not.NotCod == NotCodToHighlight ? "TL_WIDTH TL_SEP TL_NEW_PUB" : Not.NotCod == NotCodToHighlight ? "TL_WIDTH TL_SEP TL_NEW_PUB" :
"TL_WIDTH TL_SEP"); "TL_WIDTH TL_SEP");
TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not, Tml_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not,
TL_Pub_GetTopMessage (Pub->PubType), Tml_Pub_GetTopMessage (Pub->PubType),
Pub->PublisherCod); Pub->PublisherCod);
HTM_LI_End (); HTM_LI_End ();
} }
@ -521,7 +521,7 @@ static unsigned TL_ListRecentPubs (struct TL_Timeline *Timeline,
/*********** Put a hidden list where publications will be inserted ***********/ /*********** Put a hidden list where publications will be inserted ***********/
/*****************************************************************************/ /*****************************************************************************/
static void TL_PutHiddenList (const char *Id) static void Tml_PutHiddenList (const char *Id)
{ {
HTM_UL_Begin ("id=\"%s\" class=\"TL_LIST\"",Id); HTM_UL_Begin ("id=\"%s\" class=\"TL_LIST\"",Id);
HTM_UL_End (); HTM_UL_End ();
@ -532,7 +532,7 @@ static void TL_PutHiddenList (const char *Id)
/*****************************************************************************/ /*****************************************************************************/
// TimeUTC holds UTC date and time in UNIX format (seconds since 1970) // TimeUTC holds UTC date and time in UNIX format (seconds since 1970)
void TL_WriteDateTime (time_t TimeUTC) void Tml_WriteDateTime (time_t TimeUTC)
{ {
char IdDateTime[Frm_MAX_BYTES_ID + 1]; char IdDateTime[Frm_MAX_BYTES_ID + 1];

View File

@ -1,7 +1,7 @@
// swad_timeline.h: social timeline // swad_timeline.h: social timeline
#ifndef _SWAD_TL #ifndef _SWAD_TML
#define _SWAD_TL #define _SWAD_TML
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -45,84 +45,72 @@
· maximum height of TL_IMAGE_SAVED_MAX_HEIGHT · maximum height of TL_IMAGE_SAVED_MAX_HEIGHT
· maintaining the original aspect ratio (aspect ratio recommended: 3:2) · maintaining the original aspect ratio (aspect ratio recommended: 3:2)
*/ */
#define TL_IMAGE_SAVED_MAX_WIDTH 768 #define Tml_IMAGE_SAVED_MAX_WIDTH 768
#define TL_IMAGE_SAVED_MAX_HEIGHT 768 #define Tml_IMAGE_SAVED_MAX_HEIGHT 768
#define TL_IMAGE_SAVED_QUALITY 90 // 1 to 100 #define Tml_IMAGE_SAVED_QUALITY 90 // 1 to 100
// in timeline posts, the quality should not be high in order to speed up the loading of images // in timeline posts, the quality should not be high in order to speed up the loading of images
/*****************************************************************************/ /*****************************************************************************/
/******************************** Public types *******************************/ /******************************** Public types *******************************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_NUM_TOP_MESSAGES (1 + 6) #define Tml_NUM_TOP_MESSAGES (1 + 6)
typedef enum typedef enum
{ {
TL_TOP_MESSAGE_NONE = 0, Tml_TOP_MESSAGE_NONE = 0,
TL_TOP_MESSAGE_COMMENTED = 1, Tml_TOP_MESSAGE_COMMENTED = 1,
TL_TOP_MESSAGE_FAVED = 2, Tml_TOP_MESSAGE_FAVED = 2,
TL_TOP_MESSAGE_UNFAVED = 3, Tml_TOP_MESSAGE_UNFAVED = 3,
TL_TOP_MESSAGE_SHARED = 4, Tml_TOP_MESSAGE_SHARED = 4,
TL_TOP_MESSAGE_UNSHARED = 5, Tml_TOP_MESSAGE_UNSHARED = 5,
TL_TOP_MESSAGE_MENTIONED = 6, Tml_TOP_MESSAGE_MENTIONED = 6,
} TL_TopMessage_t; } Tml_TopMessage_t;
#define TL_NUM_WHAT_TO_GET 3 #define Tml_NUM_WHAT_TO_GET 3
typedef enum typedef enum
{ {
TL_GET_RECENT_TIMELINE, // Recent timeline is shown when the user clicks on action menu,... Tml_GET_RECENT_TIMELINE, // Recent timeline is shown when the user clicks on action menu,...
// or after editing timeline // or after editing timeline
TL_GET_ONLY_NEW_PUBS, // New publications are retrieved via AJAX Tml_GET_ONLY_NEW_PUBS, // New publications are retrieved via AJAX
// automatically from time to time // automatically from time to time
TL_GET_ONLY_OLD_PUBS, // Old publications are retrieved via AJAX Tml_GET_ONLY_OLD_PUBS, // Old publications are retrieved via AJAX
// when the user clicks on link at bottom of timeline // when the user clicks on link at bottom of timeline
} TL_WhatToGet_t; } Tml_WhatToGet_t;
struct TL_Timeline struct Tml_Timeline
{ {
TL_Usr_UsrOrGbl_t UsrOrGbl; Tml_Usr_UsrOrGbl_t UsrOrGbl;
Usr_Who_t Who; Usr_Who_t Who;
TL_WhatToGet_t WhatToGet; Tml_WhatToGet_t WhatToGet;
struct struct
{ {
struct TL_Pub_Publication *Top; // Points to first element in list of publications struct Tml_Pub_Publication *Top; // Points to first element in list of publications
struct TL_Pub_Publication *Bottom; // Points to last element in list of publications struct Tml_Pub_Publication *Bottom; // Points to last element in list of publications
} Pubs; } Pubs;
long NotCod; // Used as parameter about social note to be edited, removed... long NotCod; // Used as parameter about social note to be edited, removed...
long PubCod; // Used as parameter about social publishing to be edited, removed... long PubCod; // Used as parameter about social publishing to be edited, removed...
}; };
/*
typedef enum
{
TL_DONT_HIGHLIGHT,
TL_HIGHLIGHT,
} TL_Highlight_t;
typedef enum
{
TL_DONT_SHOW_ALONE,
TL_SHOW_ALONE,
} TL_ShowAlone_t;
*/
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_InitTimelineGbl (struct TL_Timeline *Timeline); void Tml_InitTimelineGbl (struct Tml_Timeline *Timeline);
void TL_ResetTimeline (struct TL_Timeline *Timeline); void Tml_ResetTimeline (struct Tml_Timeline *Timeline);
void TL_ShowTimelineGbl (void); void Tml_ShowTimelineGbl (void);
void TL_ShowNoteAndTimelineGbl (struct TL_Timeline *Timeline); void Tml_ShowNoteAndTimelineGbl (struct Tml_Timeline *Timeline);
void TL_ShowTimelineGblHighlighting (struct TL_Timeline *Timeline,long NotCod); void Tml_ShowTimelineGblHighlighting (struct Tml_Timeline *Timeline,long NotCod);
void TL_ShowTimelineUsr (struct TL_Timeline *Timeline); void Tml_ShowTimelineUsr (struct Tml_Timeline *Timeline);
void TL_ShowTimelineUsrHighlighting (struct TL_Timeline *Timeline,long NotCod); void Tml_ShowTimelineUsrHighlighting (struct Tml_Timeline *Timeline,long NotCod);
void TL_RefreshNewTimelineGbl (void); void Tml_RefreshNewTimelineGbl (void);
void TL_RefreshOldTimelineGbl (void); void Tml_RefreshOldTimelineGbl (void);
void TL_RefreshOldTimelineUsr (void); void Tml_RefreshOldTimelineUsr (void);
void TL_WriteDateTime (time_t TimeUTC); void Tml_WriteDateTime (time_t TimeUTC);
#endif #endif

View File

@ -48,14 +48,14 @@
/************************* Private constants and types ***********************/ /************************* Private constants and types ***********************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_Com_NUM_VISIBLE_COMMENTS 3 // Maximum number of comments visible before expanding them #define Tml_Com_NUM_VISIBLE_COMMENTS 3 // Maximum number of comments visible before expanding them
#define TL_Com_NUM_CONTRACT_EXPAND 2 #define Tml_Com_NUM_CONTRACT_EXPAND 2
typedef enum typedef enum
{ {
TL_Com_CONTRACT = 0, Tml_Com_CONTRACT = 0,
TL_Com_EXPAND = 1, Tml_Com_EXPAND = 1,
} TL_Com_ContractExpand_t; } Tml_Com_ContractExpand_t;
/*****************************************************************************/ /*****************************************************************************/
/************** External global variables from others modules ****************/ /************** External global variables from others modules ****************/
@ -71,54 +71,54 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat); static void Tml_Com_ShowAuthorPhoto (struct UsrData *UsrDat);
static void TL_Com_PutFormToWriteNewComm (const struct TL_Timeline *Timeline, static void Tml_Com_PutFormToWriteNewComm (const struct Tml_Timeline *Timeline,
long NotCod); long NotCod);
static unsigned TL_Com_WriteHiddenComms (struct TL_Timeline *Timeline, static unsigned Tml_Com_WriteHiddenComms (struct Tml_Timeline *Timeline,
long NotCod, long NotCod,
char IdComms[Frm_MAX_BYTES_ID + 1], char IdComms[Frm_MAX_BYTES_ID + 1],
unsigned NumInitialCommsToGet); unsigned NumInitialCommsToGet);
static void TL_Com_ListComms (const struct TL_Timeline *Timeline, static void Tml_Com_ListComms (const struct Tml_Timeline *Timeline,
unsigned NumComms,MYSQL_RES *mysql_res); unsigned NumComms,MYSQL_RES *mysql_res);
static void TL_Com_WriteOneCommInList (const struct TL_Timeline *Timeline, static void Tml_Com_WriteOneCommInList (const struct Tml_Timeline *Timeline,
MYSQL_RES *mysql_res); MYSQL_RES *mysql_res);
static void TL_Com_LinkToShowComms (TL_Com_ContractExpand_t ConExp, static void Tml_Com_LinkToShowComms (Tml_Com_ContractExpand_t ConExp,
const char IdComms[Frm_MAX_BYTES_ID + 1], const char IdComms[Frm_MAX_BYTES_ID + 1],
unsigned NumComms); unsigned NumComms);
static void TL_Com_PutIconToToggleComms (const char *UniqueId, static void Tml_Com_PutIconToToggleComms (const char *UniqueId,
const char *Icon,const char *Text); const char *Icon,const char *Text);
static void TL_Com_CheckAndWriteComm (const struct TL_Timeline *Timeline, static void Tml_Com_CheckAndWriteComm (const struct Tml_Timeline *Timeline,
struct TL_Com_Comment *Com); struct Tml_Com_Comment *Com);
static void TL_Com_WriteComm (const struct TL_Timeline *Timeline, static void Tml_Com_WriteComm (const struct Tml_Timeline *Timeline,
struct TL_Com_Comment *Com); struct Tml_Com_Comment *Com);
static void TL_Com_WriteAuthorTimeAndContent (struct TL_Com_Comment *Com, static void Tml_Com_WriteAuthorTimeAndContent (struct Tml_Com_Comment *Com,
const struct UsrData *UsrDat); const struct UsrData *UsrDat);
static void TL_Com_WriteAuthorName (const struct UsrData *UsrDat); static void Tml_Com_WriteAuthorName (const struct UsrData *UsrDat);
static void TL_Com_WriteContent (struct TL_Com_Comment *Com); static void Tml_Com_WriteContent (struct Tml_Com_Comment *Com);
static void TL_Com_WriteButtons (const struct TL_Timeline *Timeline, static void Tml_Com_WriteButtons (const struct Tml_Timeline *Timeline,
const struct TL_Com_Comment *Com, const struct Tml_Com_Comment *Com,
const struct UsrData *UsrDat); const struct UsrData *UsrDat);
static void TL_Com_PutFormToRemoveComm (const struct TL_Timeline *Timeline, static void Tml_Com_PutFormToRemoveComm (const struct Tml_Timeline *Timeline,
long PubCod); long PubCod);
static long TL_Com_ReceiveComm (void); static long Tml_Com_ReceiveComm (void);
static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline); static void Tml_Com_RequestRemovalComm (struct Tml_Timeline *Timeline);
static void TL_Com_PutParamsRemoveComm (void *Timeline); static void Tml_Com_PutParamsRemoveComm (void *Timeline);
static void TL_Com_RemoveComm (void); static void Tml_Com_RemoveComm (void);
static void TL_Com_GetDataOfCommFromRow (MYSQL_ROW row, static void Tml_Com_GetDataOfCommFromRow (MYSQL_ROW row,
struct TL_Com_Comment *Com); struct Tml_Com_Comment *Com);
static void TL_Com_ResetComm (struct TL_Com_Comment *Com); static void Tml_Com_ResetComm (struct Tml_Com_Comment *Com);
/*****************************************************************************/ /*****************************************************************************/
/********* Put an icon to toggle on/off the form to comment a note ***********/ /********* Put an icon to toggle on/off the form to comment a note ***********/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_PutIconToToggleComm (const char UniqueId[Frm_MAX_BYTES_ID + 1]) void Tml_Com_PutIconToToggleComm (const char UniqueId[Frm_MAX_BYTES_ID + 1])
{ {
extern const char *Txt_Comment; extern const char *Txt_Comment;
@ -145,7 +145,7 @@ void TL_Com_PutIconToToggleComm (const char UniqueId[Frm_MAX_BYTES_ID + 1])
/********** Put an icon to toggle on/off the form to comment a note **********/ /********** Put an icon to toggle on/off the form to comment a note **********/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_PutIconCommDisabled (void) void Tml_Com_PutIconCommDisabled (void)
{ {
extern const char *Txt_Comment; extern const char *Txt_Comment;
@ -164,9 +164,9 @@ void TL_Com_PutIconCommDisabled (void)
/************************* Form to comment a note ****************************/ /************************* Form to comment a note ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_PutPhotoAndFormToWriteNewComm (const struct TL_Timeline *Timeline, void Tml_Com_PutPhotoAndFormToWriteNewComm (const struct Tml_Timeline *Timeline,
long NotCod, long NotCod,
const char IdNewComm[Frm_MAX_BYTES_ID + 1]) const char IdNewComm[Frm_MAX_BYTES_ID + 1])
{ {
/***** Begin container *****/ /***** Begin container *****/
HTM_DIV_Begin ("id=\"%s\" class=\"TL_FORM_NEW_COM TL_RIGHT_WIDTH\"" HTM_DIV_Begin ("id=\"%s\" class=\"TL_FORM_NEW_COM TL_RIGHT_WIDTH\""
@ -174,10 +174,10 @@ void TL_Com_PutPhotoAndFormToWriteNewComm (const struct TL_Timeline *Timeline,
IdNewComm); IdNewComm);
/***** Left: write author's photo (my photo) *****/ /***** Left: write author's photo (my photo) *****/
TL_Com_ShowAuthorPhoto (&Gbl.Usrs.Me.UsrDat); Tml_Com_ShowAuthorPhoto (&Gbl.Usrs.Me.UsrDat);
/***** Right: form to write the comment *****/ /***** Right: form to write the comment *****/
TL_Com_PutFormToWriteNewComm (Timeline,NotCod); Tml_Com_PutFormToWriteNewComm (Timeline,NotCod);
/***** End container *****/ /***** End container *****/
HTM_DIV_End (); HTM_DIV_End ();
@ -187,7 +187,7 @@ void TL_Com_PutPhotoAndFormToWriteNewComm (const struct TL_Timeline *Timeline,
/********************* Show photo of author of a comment *********************/ /********************* Show photo of author of a comment *********************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat) static void Tml_Com_ShowAuthorPhoto (struct UsrData *UsrDat)
{ {
/***** Show author's photo *****/ /***** Show author's photo *****/
/* Begin container */ /* Begin container */
@ -204,8 +204,8 @@ static void TL_Com_ShowAuthorPhoto (struct UsrData *UsrDat)
/**************************** Form with textarea *****************************/ /**************************** Form with textarea *****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_PutFormToWriteNewComm (const struct TL_Timeline *Timeline, static void Tml_Com_PutFormToWriteNewComm (const struct Tml_Timeline *Timeline,
long NotCod) long NotCod)
{ {
extern const char *Txt_New_TIMELINE_comment; extern const char *Txt_New_TIMELINE_comment;
@ -213,15 +213,15 @@ static void TL_Com_PutFormToWriteNewComm (const struct TL_Timeline *Timeline,
HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\""); HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\"");
/***** Begin form to write the post *****/ /***** Begin form to write the post *****/
TL_Frm_BeginForm (Timeline,TL_Frm_RECEIVE_COMM); Tml_Frm_BeginForm (Timeline,Tml_Frm_RECEIVE_COMM);
TL_Not_PutHiddenParamNotCod (NotCod); Tml_Not_PutHiddenParamNotCod (NotCod);
/***** Textarea and button *****/ /***** Textarea and button *****/
TL_Pst_PutTextarea (Txt_New_TIMELINE_comment, Tml_Pst_PutTextarea (Txt_New_TIMELINE_comment,
"TL_COM_TEXTAREA TL_COMM_WIDTH"); "TL_COM_TEXTAREA TL_COMM_WIDTH");
/***** End form *****/ /***** End form *****/
TL_Frm_EndForm (); Tml_Frm_EndForm ();
/***** End container *****/ /***** End container *****/
HTM_DIV_End (); HTM_DIV_End ();
@ -231,8 +231,8 @@ static void TL_Com_PutFormToWriteNewComm (const struct TL_Timeline *Timeline,
/*********************** Write comments in a note ****************************/ /*********************** Write comments in a note ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline, void Tml_Com_WriteCommsInNote (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not) const struct Tml_Not_Note *Not)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumComms; unsigned NumComms;
@ -242,7 +242,7 @@ void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline,
char IdComms[Frm_MAX_BYTES_ID + 1]; char IdComms[Frm_MAX_BYTES_ID + 1];
/***** Get number of comments in note *****/ /***** Get number of comments in note *****/
NumComms = TL_DB_GetNumCommsInNote (Not->NotCod); NumComms = Tml_DB_GetNumCommsInNote (Not->NotCod);
/***** Trivial check: if no comments ==> nothing to do *****/ /***** Trivial check: if no comments ==> nothing to do *****/
if (!NumComms) if (!NumComms)
@ -252,19 +252,19 @@ void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline,
and how many final comments will be visible *****/ and how many final comments will be visible *****/
// Never hide only one comment // Never hide only one comment
// So, the number of comments initially hidden must be 0 or >= 2 // So, the number of comments initially hidden must be 0 or >= 2
if (NumComms <= TL_Com_NUM_VISIBLE_COMMENTS + 1) if (NumComms <= Tml_Com_NUM_VISIBLE_COMMENTS + 1)
{ {
NumInitialComms = 0; NumInitialComms = 0;
NumFinalCommsToGet = NumComms; NumFinalCommsToGet = NumComms;
} }
else else
{ {
NumInitialComms = NumComms - TL_Com_NUM_VISIBLE_COMMENTS; NumInitialComms = NumComms - Tml_Com_NUM_VISIBLE_COMMENTS;
NumFinalCommsToGet = TL_Com_NUM_VISIBLE_COMMENTS; NumFinalCommsToGet = Tml_Com_NUM_VISIBLE_COMMENTS;
} }
/***** Get final comments of this note from database *****/ /***** Get final comments of this note from database *****/
NumFinalComms = TL_DB_GetFinalComms (Not->NotCod,NumFinalCommsToGet,&mysql_res); NumFinalComms = Tml_DB_GetFinalComms (Not->NotCod,NumFinalCommsToGet,&mysql_res);
/* /*
Before clicking "See prev..." --> After clicking "See prev..." Before clicking "See prev..." --> After clicking "See prev..."
_________________________________ _________________________________ _________________________________ _________________________________
@ -314,18 +314,18 @@ void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline,
Frm_SetUniqueId (IdComms); Frm_SetUniqueId (IdComms);
/***** Link (initially hidden) to show only the latest comments *****/ /***** Link (initially hidden) to show only the latest comments *****/
TL_Com_LinkToShowComms (TL_Com_CONTRACT,IdComms,NumFinalComms); Tml_Com_LinkToShowComms (Tml_Com_CONTRACT,IdComms,NumFinalComms);
/***** Div with form to show hidden coments, /***** Div with form to show hidden coments,
which content will be updated via AJAX *****/ which content will be updated via AJAX *****/
TL_Frm_FormToShowHiddenComms (Not->NotCod,IdComms,NumInitialComms); Tml_Frm_FormToShowHiddenComms (Not->NotCod,IdComms,NumInitialComms);
} }
/***** List final visible comments *****/ /***** List final visible comments *****/
if (NumFinalComms) if (NumFinalComms)
{ {
HTM_UL_Begin ("class=\"TL_LIST\""); // Never hidden, always visible HTM_UL_Begin ("class=\"TL_LIST\""); // Never hidden, always visible
TL_Com_ListComms (Timeline,NumFinalComms,mysql_res); Tml_Com_ListComms (Timeline,NumFinalComms,mysql_res);
HTM_UL_End (); HTM_UL_End ();
} }
@ -337,38 +337,38 @@ void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline,
/********************** Write hidden comments via AJAX ***********************/ /********************** Write hidden comments via AJAX ***********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_ShowHiddenCommsUsr (void) void Tml_Com_ShowHiddenCommsUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Show hidden comments *****/ /***** Show hidden comments *****/
TL_Com_ShowHiddenCommsGbl (); Tml_Com_ShowHiddenCommsGbl ();
} }
void TL_Com_ShowHiddenCommsGbl (void) void Tml_Com_ShowHiddenCommsGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
long NotCod; long NotCod;
char IdComms[Frm_MAX_BYTES_ID + 1]; char IdComms[Frm_MAX_BYTES_ID + 1];
unsigned NumInitialCommsToGet; unsigned NumInitialCommsToGet;
unsigned NumInitialCommsGot; unsigned NumInitialCommsGot;
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** Get parameters *****/ /***** Get parameters *****/
/* Get note code, identifier and number of comments to get */ /* Get note code, identifier and number of comments to get */
NotCod = TL_Not_GetParamNotCod (); NotCod = Tml_Not_GetParamNotCod ();
Par_GetParToText ("IdComments",IdComms,Frm_MAX_BYTES_ID); Par_GetParToText ("IdComments",IdComms,Frm_MAX_BYTES_ID);
NumInitialCommsToGet = (unsigned) Par_GetParToLong ("NumHidCom"); NumInitialCommsToGet = (unsigned) Par_GetParToLong ("NumHidCom");
/***** Write HTML inside DIV with hidden comments *****/ /***** Write HTML inside DIV with hidden comments *****/
NumInitialCommsGot = NumInitialCommsGot =
TL_Com_WriteHiddenComms (&Timeline,NotCod,IdComms,NumInitialCommsToGet); Tml_Com_WriteHiddenComms (&Timeline,NotCod,IdComms,NumInitialCommsToGet);
/***** Link to show the first comments *****/ /***** Link to show the first comments *****/
TL_Com_LinkToShowComms (TL_Com_EXPAND,IdComms,NumInitialCommsGot); Tml_Com_LinkToShowComms (Tml_Com_EXPAND,IdComms,NumInitialCommsGot);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -376,22 +376,22 @@ void TL_Com_ShowHiddenCommsGbl (void)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of comments got // Returns the number of comments got
static unsigned TL_Com_WriteHiddenComms (struct TL_Timeline *Timeline, static unsigned Tml_Com_WriteHiddenComms (struct Tml_Timeline *Timeline,
long NotCod, long NotCod,
char IdComms[Frm_MAX_BYTES_ID + 1], char IdComms[Frm_MAX_BYTES_ID + 1],
unsigned NumInitialCommsToGet) unsigned NumInitialCommsToGet)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned long NumInitialCommsGot; unsigned long NumInitialCommsGot;
/***** Get comments of this note from database *****/ /***** Get comments of this note from database *****/
NumInitialCommsGot = TL_DB_GetInitialComms (NotCod, NumInitialCommsGot = Tml_DB_GetInitialComms (NotCod,
NumInitialCommsToGet, NumInitialCommsToGet,
&mysql_res); &mysql_res);
/***** List comments *****/ /***** List comments *****/
HTM_UL_Begin ("id=\"com_%s\" class=\"TL_LIST\"",IdComms); HTM_UL_Begin ("id=\"com_%s\" class=\"TL_LIST\"",IdComms);
TL_Com_ListComms (Timeline,NumInitialCommsGot,mysql_res); Tml_Com_ListComms (Timeline,NumInitialCommsGot,mysql_res);
HTM_UL_End (); HTM_UL_End ();
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
@ -404,8 +404,8 @@ static unsigned TL_Com_WriteHiddenComms (struct TL_Timeline *Timeline,
/*********************** Write comments in a note ****************************/ /*********************** Write comments in a note ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_ListComms (const struct TL_Timeline *Timeline, static void Tml_Com_ListComms (const struct Tml_Timeline *Timeline,
unsigned NumComms,MYSQL_RES *mysql_res) unsigned NumComms,MYSQL_RES *mysql_res)
{ {
unsigned NumCom; unsigned NumCom;
@ -413,29 +413,29 @@ static void TL_Com_ListComms (const struct TL_Timeline *Timeline,
for (NumCom = 0; for (NumCom = 0;
NumCom < NumComms; NumCom < NumComms;
NumCom++) NumCom++)
TL_Com_WriteOneCommInList (Timeline,mysql_res); Tml_Com_WriteOneCommInList (Timeline,mysql_res);
} }
/*****************************************************************************/ /*****************************************************************************/
/************************* Write a comment in list ***************************/ /************************* Write a comment in list ***************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_WriteOneCommInList (const struct TL_Timeline *Timeline, static void Tml_Com_WriteOneCommInList (const struct Tml_Timeline *Timeline,
MYSQL_RES *mysql_res) MYSQL_RES *mysql_res)
{ {
MYSQL_ROW row; MYSQL_ROW row;
struct TL_Com_Comment Com; struct Tml_Com_Comment Com;
/***** Initialize image *****/ /***** Initialize image *****/
Med_MediaConstructor (&Com.Content.Media); Med_MediaConstructor (&Com.Content.Media);
/***** Get data of comment *****/ /***** Get data of comment *****/
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
TL_Com_GetDataOfCommFromRow (row,&Com); Tml_Com_GetDataOfCommFromRow (row,&Com);
/***** Write comment *****/ /***** Write comment *****/
HTM_LI_Begin ("class=\"TL_COM\""); HTM_LI_Begin ("class=\"TL_COM\"");
TL_Com_CheckAndWriteComm (Timeline,&Com); Tml_Com_CheckAndWriteComm (Timeline,&Com);
HTM_LI_End (); HTM_LI_End ();
/***** Free image *****/ /***** Free image *****/
@ -446,23 +446,23 @@ static void TL_Com_WriteOneCommInList (const struct TL_Timeline *Timeline,
/**** Link to "show only the latest comments" / "show the first comments" ****/ /**** Link to "show only the latest comments" / "show the first comments" ****/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_LinkToShowComms (TL_Com_ContractExpand_t ConExp, static void Tml_Com_LinkToShowComms (Tml_Com_ContractExpand_t ConExp,
const char IdComms[Frm_MAX_BYTES_ID + 1], const char IdComms[Frm_MAX_BYTES_ID + 1],
unsigned NumComms) unsigned NumComms)
{ {
extern const char *Txt_See_only_the_latest_X_COMMENTS; extern const char *Txt_See_only_the_latest_X_COMMENTS;
extern const char *Txt_See_the_previous_X_COMMENTS; extern const char *Txt_See_the_previous_X_COMMENTS;
static const char *Id[TL_Com_NUM_CONTRACT_EXPAND] = static const char *Id[Tml_Com_NUM_CONTRACT_EXPAND] =
{ {
"con", // contract "con", // contract
"exp", // expand "exp", // expand
}; };
static const char *Icon[TL_Com_NUM_CONTRACT_EXPAND] = static const char *Icon[Tml_Com_NUM_CONTRACT_EXPAND] =
{ {
"angle-down.svg", // contract "angle-down.svg", // contract
"angle-up.svg", // expand "angle-up.svg", // expand
}; };
const char *Text[TL_Com_NUM_CONTRACT_EXPAND] = const char *Text[Tml_Com_NUM_CONTRACT_EXPAND] =
{ {
Txt_See_only_the_latest_X_COMMENTS, // contract Txt_See_only_the_latest_X_COMMENTS, // contract
Txt_See_the_previous_X_COMMENTS, // expand Txt_See_the_previous_X_COMMENTS, // expand
@ -475,7 +475,7 @@ static void TL_Com_LinkToShowComms (TL_Com_ContractExpand_t ConExp,
Id[ConExp],IdComms); Id[ConExp],IdComms);
/* Icon and text */ /* Icon and text */
TL_Com_PutIconToToggleComms (IdComms,Icon[ConExp], Tml_Com_PutIconToToggleComms (IdComms,Icon[ConExp],
Str_BuildStringLong (Text[ConExp],(long) NumComms)); Str_BuildStringLong (Text[ConExp],(long) NumComms));
Str_FreeString (); Str_FreeString ();
@ -487,8 +487,8 @@ static void TL_Com_LinkToShowComms (TL_Com_ContractExpand_t ConExp,
/********** Put an icon to toggle on/off comments in a publication ***********/ /********** Put an icon to toggle on/off comments in a publication ***********/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_PutIconToToggleComms (const char *UniqueId, static void Tml_Com_PutIconToToggleComms (const char *UniqueId,
const char *Icon,const char *Text) const char *Icon,const char *Text)
{ {
extern const char *The_ClassFormLinkInBox[The_NUM_THEMES]; extern const char *The_ClassFormLinkInBox[The_NUM_THEMES];
char *OnClick; char *OnClick;
@ -510,8 +510,8 @@ static void TL_Com_PutIconToToggleComms (const char *UniqueId,
/************************** Check and write comment **************************/ /************************** Check and write comment **************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_CheckAndWriteComm (const struct TL_Timeline *Timeline, static void Tml_Com_CheckAndWriteComm (const struct Tml_Timeline *Timeline,
struct TL_Com_Comment *Com) struct Tml_Com_Comment *Com)
{ {
/*__________________________________________ /*__________________________________________
| _____ | | | \ \ | _____ | | | \ \
@ -538,15 +538,15 @@ static void TL_Com_CheckAndWriteComm (const struct TL_Timeline *Timeline,
} }
/***** Write comment *****/ /***** Write comment *****/
TL_Com_WriteComm (Timeline,Com); Tml_Com_WriteComm (Timeline,Com);
} }
/*****************************************************************************/ /*****************************************************************************/
/******************************** Write comment ******************************/ /******************************** Write comment ******************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_WriteComm (const struct TL_Timeline *Timeline, static void Tml_Com_WriteComm (const struct Tml_Timeline *Timeline,
struct TL_Com_Comment *Com) struct Tml_Com_Comment *Com)
{ {
struct UsrData UsrDat; // Author of the comment struct UsrData UsrDat; // Author of the comment
@ -556,17 +556,17 @@ static void TL_Com_WriteComm (const struct TL_Timeline *Timeline,
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
/***** Left: author's photo *****/ /***** Left: author's photo *****/
TL_Com_ShowAuthorPhoto (&UsrDat); Tml_Com_ShowAuthorPhoto (&UsrDat);
/***** Right: author's name, time, content, and buttons *****/ /***** Right: author's name, time, content, and buttons *****/
/* Begin container */ /* Begin container */
HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\""); HTM_DIV_Begin ("class=\"TL_COM_CONT TL_COMM_WIDTH\"");
/* Right top: author's name, time, and content */ /* Right top: author's name, time, and content */
TL_Com_WriteAuthorTimeAndContent (Com,&UsrDat); Tml_Com_WriteAuthorTimeAndContent (Com,&UsrDat);
/* Right bottom: buttons */ /* Right bottom: buttons */
TL_Com_WriteButtons (Timeline,Com,&UsrDat); Tml_Com_WriteButtons (Timeline,Com,&UsrDat);
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();
@ -579,24 +579,24 @@ static void TL_Com_WriteComm (const struct TL_Timeline *Timeline,
/**** Write top right part of a note: author's name, time and note content ***/ /**** Write top right part of a note: author's name, time and note content ***/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_WriteAuthorTimeAndContent (struct TL_Com_Comment *Com, static void Tml_Com_WriteAuthorTimeAndContent (struct Tml_Com_Comment *Com,
const struct UsrData *UsrDat) // Author const struct UsrData *UsrDat) // Author
{ {
/***** Write author's full name and nickname *****/ /***** Write author's full name and nickname *****/
TL_Com_WriteAuthorName (UsrDat); Tml_Com_WriteAuthorName (UsrDat);
/***** Write date and time *****/ /***** Write date and time *****/
TL_WriteDateTime (Com->DateTimeUTC); Tml_WriteDateTime (Com->DateTimeUTC);
/***** Write content of the comment *****/ /***** Write content of the comment *****/
TL_Com_WriteContent (Com); Tml_Com_WriteContent (Com);
} }
/*****************************************************************************/ /*****************************************************************************/
/*************** Write name of author of a comment to a note *****************/ /*************** Write name of author of a comment to a note *****************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_WriteAuthorName (const struct UsrData *UsrDat) // Author static void Tml_Com_WriteAuthorName (const struct UsrData *UsrDat) // Author
{ {
extern const char *Txt_My_public_profile; extern const char *Txt_My_public_profile;
extern const char *Txt_Another_user_s_profile; extern const char *Txt_Another_user_s_profile;
@ -621,7 +621,7 @@ static void TL_Com_WriteAuthorName (const struct UsrData *UsrDat) // Author
/************************* Write content of comment **************************/ /************************* Write content of comment **************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_WriteContent (struct TL_Com_Comment *Com) static void Tml_Com_WriteContent (struct Tml_Com_Comment *Com)
{ {
/***** Write content of the comment *****/ /***** Write content of the comment *****/
if (Com->Content.Txt[0]) if (Com->Content.Txt[0])
@ -640,9 +640,9 @@ static void TL_Com_WriteContent (struct TL_Com_Comment *Com)
/********************* Write bottom part of a comment ************************/ /********************* Write bottom part of a comment ************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_WriteButtons (const struct TL_Timeline *Timeline, static void Tml_Com_WriteButtons (const struct Tml_Timeline *Timeline,
const struct TL_Com_Comment *Com, const struct Tml_Com_Comment *Com,
const struct UsrData *UsrDat) // Author const struct UsrData *UsrDat) // Author
{ {
static unsigned NumDiv = 0; // Used to create unique div id for fav static unsigned NumDiv = 0; // Used to create unique div id for fav
@ -654,16 +654,16 @@ static void TL_Com_WriteButtons (const struct TL_Timeline *Timeline,
/***** Foot column 1: fav zone *****/ /***** Foot column 1: fav zone *****/
HTM_DIV_Begin ("id=\"fav_com_%s_%u\" class=\"TL_FAV_COM TL_FAV_WIDTH\"", HTM_DIV_Begin ("id=\"fav_com_%s_%u\" class=\"TL_FAV_COM TL_FAV_WIDTH\"",
Gbl.UniqueNameEncrypted,NumDiv); Gbl.UniqueNameEncrypted,NumDiv);
TL_Usr_PutIconFavSha (TL_Usr_FAV_UNF_COMM, Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_COMM,
Com->PubCod,Com->UsrCod,Com->NumFavs, Com->PubCod,Com->UsrCod,Com->NumFavs,
TL_Usr_SHOW_FEW_USRS); Tml_Usr_SHOW_FEW_USRS);
HTM_DIV_End (); HTM_DIV_End ();
/***** Foot column 2: icon to remove this comment *****/ /***** Foot column 2: icon to remove this comment *****/
HTM_DIV_Begin ("class=\"TL_REM\""); HTM_DIV_Begin ("class=\"TL_REM\"");
if (Usr_ItsMe (UsrDat->UsrCod)) // I am the author if (Usr_ItsMe (UsrDat->UsrCod)) // I am the author
TL_Com_PutFormToRemoveComm (Timeline,Com->PubCod); Tml_Com_PutFormToRemoveComm (Timeline,Com->PubCod);
HTM_DIV_End (); HTM_DIV_End ();
/***** End buttons container *****/ /***** End buttons container *****/
@ -674,34 +674,34 @@ static void TL_Com_WriteButtons (const struct TL_Timeline *Timeline,
/************************* Form to remove comment ****************************/ /************************* Form to remove comment ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_PutFormToRemoveComm (const struct TL_Timeline *Timeline, static void Tml_Com_PutFormToRemoveComm (const struct Tml_Timeline *Timeline,
long PubCod) long PubCod)
{ {
extern const char *Txt_Remove; extern const char *Txt_Remove;
/***** Form to remove publication *****/ /***** Form to remove publication *****/
/* Begin form */ /* Begin form */
TL_Frm_BeginForm (Timeline,TL_Frm_REQ_REM_COMM); Tml_Frm_BeginForm (Timeline,Tml_Frm_REQ_REM_COMM);
TL_Pub_PutHiddenParamPubCod (PubCod); Tml_Pub_PutHiddenParamPubCod (PubCod);
/* Icon to remove */ /* Icon to remove */
Ico_PutIconLink ("trash.svg",Txt_Remove); Ico_PutIconLink ("trash.svg",Txt_Remove);
/* End form */ /* End form */
TL_Frm_EndForm (); Tml_Frm_EndForm ();
} }
/*****************************************************************************/ /*****************************************************************************/
/******************************* Comment a note ******************************/ /******************************* Comment a note ******************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_ReceiveCommUsr (void) void Tml_Com_ReceiveCommUsr (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
long NotCod; long NotCod;
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
@ -714,38 +714,38 @@ void TL_Com_ReceiveCommUsr (void)
/***** Receive comment in a note /***** Receive comment in a note
and write updated timeline after commenting (user) *****/ and write updated timeline after commenting (user) *****/
NotCod = TL_Com_ReceiveComm (); NotCod = Tml_Com_ReceiveComm ();
TL_ShowTimelineUsrHighlighting (&Timeline,NotCod); Tml_ShowTimelineUsrHighlighting (&Timeline,NotCod);
/***** End section *****/ /***** End section *****/
HTM_SECTION_End (); HTM_SECTION_End ();
} }
void TL_Com_ReceiveCommGbl (void) void Tml_Com_ReceiveCommGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
long NotCod; long NotCod;
/***** Initialize timeline *****/ /***** Initialize timeline *****/
TL_InitTimelineGbl (&Timeline); Tml_InitTimelineGbl (&Timeline);
/***** Receive comment in a note *****/ /***** Receive comment in a note *****/
NotCod = TL_Com_ReceiveComm (); NotCod = Tml_Com_ReceiveComm ();
/***** Write updated timeline after commenting (global) *****/ /***** Write updated timeline after commenting (global) *****/
TL_ShowTimelineGblHighlighting (&Timeline,NotCod); Tml_ShowTimelineGblHighlighting (&Timeline,NotCod);
} }
static long TL_Com_ReceiveComm (void) static long Tml_Com_ReceiveComm (void)
{ {
extern const char *Txt_The_post_no_longer_exists; extern const char *Txt_The_post_no_longer_exists;
struct TL_Pst_Content Content; struct Tml_Pst_Content Content;
struct TL_Not_Note Not; struct Tml_Not_Note Not;
struct TL_Pub_Publication Pub; struct Tml_Pub_Publication Pub;
/***** Get data of note *****/ /***** Get data of note *****/
Not.NotCod = TL_Not_GetParamNotCod (); Not.NotCod = Tml_Not_GetParamNotCod ();
TL_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
/***** Trivial check: note code *****/ /***** Trivial check: note code *****/
if (Not.NotCod <= 0) if (Not.NotCod <= 0)
@ -762,9 +762,9 @@ static long TL_Com_ReceiveComm (void)
Med_MediaConstructor (&Content.Media); Med_MediaConstructor (&Content.Media);
/***** Get attached image (action, file and title) *****/ /***** Get attached image (action, file and title) *****/
Content.Media.Width = TL_IMAGE_SAVED_MAX_WIDTH; Content.Media.Width = Tml_IMAGE_SAVED_MAX_WIDTH;
Content.Media.Height = TL_IMAGE_SAVED_MAX_HEIGHT; Content.Media.Height = Tml_IMAGE_SAVED_MAX_HEIGHT;
Content.Media.Quality = TL_IMAGE_SAVED_QUALITY; Content.Media.Quality = Tml_IMAGE_SAVED_QUALITY;
Med_GetMediaFromForm (-1L,-1L,-1,&Content.Media,NULL,NULL); Med_GetMediaFromForm (-1L,-1L,-1,&Content.Media,NULL,NULL);
Ale_ShowAlerts (NULL); Ale_ShowAlerts (NULL);
@ -778,11 +778,11 @@ static long TL_Com_ReceiveComm (void)
/* Insert into publications */ /* Insert into publications */
Pub.NotCod = Not.NotCod; Pub.NotCod = Not.NotCod;
Pub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod; Pub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Pub.PubType = TL_Pub_COMMENT_TO_NOTE; Pub.PubType = Tml_Pub_COMMENT_TO_NOTE;
TL_Pub_PublishPubInTimeline (&Pub); // Set Pub.PubCod Tml_Pub_PublishPubInTimeline (&Pub); // Set Pub.PubCod
/* Insert comment content in the database */ /* Insert comment content in the database */
TL_DB_InsertCommContent (Pub.PubCod,&Content); Tml_DB_InsertCommContent (Pub.PubCod,&Content);
/***** Store notifications about the new comment *****/ /***** Store notifications about the new comment *****/
Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_TL_COMMENT,Pub.PubCod); Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_TL_COMMENT,Pub.PubCod);
@ -801,12 +801,12 @@ static long TL_Com_ReceiveComm (void)
/**************** Request the removal of a comment in a note *****************/ /**************** Request the removal of a comment in a note *****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_RequestRemComUsr (void) void Tml_Com_RequestRemComUsr (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
@ -818,43 +818,43 @@ void TL_Com_RequestRemComUsr (void)
HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID); HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID);
/***** Request the removal of comment in note *****/ /***** Request the removal of comment in note *****/
TL_Com_RequestRemovalComm (&Timeline); Tml_Com_RequestRemovalComm (&Timeline);
/***** Write timeline again (user) *****/ /***** Write timeline again (user) *****/
TL_ShowTimelineUsr (&Timeline); Tml_ShowTimelineUsr (&Timeline);
/***** End section *****/ /***** End section *****/
HTM_SECTION_End (); HTM_SECTION_End ();
} }
void TL_Com_RequestRemComGbl (void) void Tml_Com_RequestRemComGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Initialize timeline *****/ /***** Initialize timeline *****/
TL_InitTimelineGbl (&Timeline); Tml_InitTimelineGbl (&Timeline);
/***** Request the removal of comment in note *****/ /***** Request the removal of comment in note *****/
TL_Com_RequestRemovalComm (&Timeline); Tml_Com_RequestRemovalComm (&Timeline);
/***** Write timeline again (global) *****/ /***** Write timeline again (global) *****/
TL_ShowNoteAndTimelineGbl (&Timeline); Tml_ShowNoteAndTimelineGbl (&Timeline);
} }
static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline) static void Tml_Com_RequestRemovalComm (struct Tml_Timeline *Timeline)
{ {
extern const char *Txt_Do_you_really_want_to_remove_the_following_comment; extern const char *Txt_Do_you_really_want_to_remove_the_following_comment;
struct TL_Com_Comment Com; struct Tml_Com_Comment Com;
/***** Initialize media *****/ /***** Initialize media *****/
Med_MediaConstructor (&Com.Content.Media); Med_MediaConstructor (&Com.Content.Media);
/***** Get data of comment *****/ /***** Get data of comment *****/
Com.PubCod = TL_Pub_GetParamPubCod (); Com.PubCod = Tml_Pub_GetParamPubCod ();
TL_Com_GetDataOfCommByCod (&Com); Tml_Com_GetDataOfCommByCod (&Com);
/***** Do some checks *****/ /***** Do some checks *****/
if (!TL_Usr_CheckIfICanRemove (Com.PubCod,Com.UsrCod)) if (!Tml_Usr_CheckIfICanRemove (Com.PubCod,Com.UsrCod))
{ {
Med_MediaDestructor (&Com.Content.Media); Med_MediaDestructor (&Com.Content.Media);
return; return;
@ -862,7 +862,7 @@ static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline)
/***** Show question and button to remove comment *****/ /***** Show question and button to remove comment *****/
/* Begin alert */ /* Begin alert */
TL_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_comment); Tml_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_comment);
/* Begin box for the comment */ /* Begin box for the comment */
Box_BoxBegin (NULL,NULL, Box_BoxBegin (NULL,NULL,
@ -875,7 +875,7 @@ static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline)
/* Show the comment */ /* Show the comment */
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\""); HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
TL_Com_CheckAndWriteComm (Timeline,&Com); Tml_Com_CheckAndWriteComm (Timeline,&Com);
HTM_DIV_End (); HTM_DIV_End ();
/* End box */ /* End box */
@ -883,8 +883,8 @@ static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline)
/* End alert */ /* End alert */
Timeline->PubCod = Com.PubCod; // Publication to be removed Timeline->PubCod = Com.PubCod; // Publication to be removed
TL_Frm_EndAlertRemove (Timeline,TL_Frm_REM_COMM, Tml_Frm_EndAlertRemove (Timeline,Tml_Frm_REM_COMM,
TL_Com_PutParamsRemoveComm); Tml_Com_PutParamsRemoveComm);
/***** Free media *****/ /***** Free media *****/
Med_MediaDestructor (&Com.Content.Media); Med_MediaDestructor (&Com.Content.Media);
@ -894,15 +894,15 @@ static void TL_Com_RequestRemovalComm (struct TL_Timeline *Timeline)
/******************** Put parameters to remove a comment *********************/ /******************** Put parameters to remove a comment *********************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_PutParamsRemoveComm (void *Timeline) static void Tml_Com_PutParamsRemoveComm (void *Timeline)
{ {
if (Timeline) if (Timeline)
{ {
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) // User's timeline if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) // User's timeline
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod); Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
else // Global timeline else // Global timeline
Usr_PutHiddenParamWho (((struct TL_Timeline *) Timeline)->Who); Usr_PutHiddenParamWho (((struct Tml_Timeline *) Timeline)->Who);
TL_Pub_PutHiddenParamPubCod (((struct TL_Timeline *) Timeline)->PubCod); Tml_Pub_PutHiddenParamPubCod (((struct Tml_Timeline *) Timeline)->PubCod);
} }
} }
@ -910,12 +910,12 @@ static void TL_Com_PutParamsRemoveComm (void *Timeline)
/***************************** Remove a comment ******************************/ /***************************** Remove a comment ******************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_RemoveComUsr (void) void Tml_Com_RemoveComUsr (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
@ -927,41 +927,41 @@ void TL_Com_RemoveComUsr (void)
HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID); HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID);
/***** Remove a comment *****/ /***** Remove a comment *****/
TL_Com_RemoveComm (); Tml_Com_RemoveComm ();
/***** Write updated timeline after removing (user) *****/ /***** Write updated timeline after removing (user) *****/
TL_ShowTimelineUsr (&Timeline); Tml_ShowTimelineUsr (&Timeline);
/***** End section *****/ /***** End section *****/
HTM_SECTION_End (); HTM_SECTION_End ();
} }
void TL_Com_RemoveComGbl (void) void Tml_Com_RemoveComGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Initialize timeline *****/ /***** Initialize timeline *****/
TL_InitTimelineGbl (&Timeline); Tml_InitTimelineGbl (&Timeline);
/***** Remove a comment *****/ /***** Remove a comment *****/
TL_Com_RemoveComm (); Tml_Com_RemoveComm ();
/***** Write updated timeline after removing (global) *****/ /***** Write updated timeline after removing (global) *****/
TL_ShowNoteAndTimelineGbl (&Timeline); Tml_ShowNoteAndTimelineGbl (&Timeline);
} }
static void TL_Com_RemoveComm (void) static void Tml_Com_RemoveComm (void)
{ {
extern const char *Txt_The_post_no_longer_exists; extern const char *Txt_The_post_no_longer_exists;
extern const char *Txt_Comment_removed; extern const char *Txt_Comment_removed;
struct TL_Com_Comment Com; struct Tml_Com_Comment Com;
/***** Initialize media *****/ /***** Initialize media *****/
Med_MediaConstructor (&Com.Content.Media); Med_MediaConstructor (&Com.Content.Media);
/***** Get data of comment *****/ /***** Get data of comment *****/
Com.PubCod = TL_Pub_GetParamPubCod (); Com.PubCod = Tml_Pub_GetParamPubCod ();
TL_Com_GetDataOfCommByCod (&Com); Tml_Com_GetDataOfCommByCod (&Com);
/***** Trivial check 1: publication code *****/ /***** Trivial check 1: publication code *****/
if (Com.PubCod <= 0) if (Com.PubCod <= 0)
@ -981,13 +981,13 @@ static void TL_Com_RemoveComm (void)
/***** Remove media associated to comment /***** Remove media associated to comment
and delete comment from database *****/ and delete comment from database *****/
TL_Com_RemoveCommMediaAndDBEntries (Com.PubCod); Tml_Com_RemoveCommMediaAndDBEntries (Com.PubCod);
/***** Free media *****/ /***** Free media *****/
Med_MediaDestructor (&Com.Content.Media); Med_MediaDestructor (&Com.Content.Media);
/***** Reset fields of comment *****/ /***** Reset fields of comment *****/
TL_Com_ResetComm (&Com); Tml_Com_ResetComm (&Com);
/***** Message of success *****/ /***** Message of success *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Comment_removed); Ale_ShowAlert (Ale_SUCCESS,Txt_Comment_removed);
@ -997,10 +997,10 @@ static void TL_Com_RemoveComm (void)
/*************** Remove comment media and database entries *******************/ /*************** Remove comment media and database entries *******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_RemoveCommMediaAndDBEntries (long PubCod) void Tml_Com_RemoveCommMediaAndDBEntries (long PubCod)
{ {
/***** Remove media associated to comment *****/ /***** Remove media associated to comment *****/
Med_RemoveMedia (TL_DB_GetMedCodFromComm (PubCod)); Med_RemoveMedia (Tml_DB_GetMedCodFromComm (PubCod));
/***** Mark possible notifications on this comment as removed *****/ /***** Mark possible notifications on this comment as removed *****/
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_COMMENT,PubCod); Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_COMMENT,PubCod);
@ -1008,20 +1008,20 @@ void TL_Com_RemoveCommMediaAndDBEntries (long PubCod)
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_MENTION,PubCod); Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_MENTION,PubCod);
/***** Remove favs for this comment *****/ /***** Remove favs for this comment *****/
TL_DB_RemoveCommFavs (PubCod); Tml_DB_RemoveCommFavs (PubCod);
/***** Remove content of this comment *****/ /***** Remove content of this comment *****/
TL_DB_RemoveCommContent (PubCod); Tml_DB_RemoveCommContent (PubCod);
/***** Remove this comment publication *****/ /***** Remove this comment publication *****/
TL_DB_RemoveCommPub (PubCod); Tml_DB_RemoveCommPub (PubCod);
} }
/*****************************************************************************/ /*****************************************************************************/
/******************* Get data of comment using its code **********************/ /******************* Get data of comment using its code **********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_GetDataOfCommByCod (struct TL_Com_Comment *Com) void Tml_Com_GetDataOfCommByCod (struct Tml_Com_Comment *Com)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1030,20 +1030,20 @@ void TL_Com_GetDataOfCommByCod (struct TL_Com_Comment *Com)
if (Com->PubCod <= 0) if (Com->PubCod <= 0)
{ {
/***** Reset fields of comment *****/ /***** Reset fields of comment *****/
TL_Com_ResetComm (Com); Tml_Com_ResetComm (Com);
return; return;
} }
/***** Get data of comment from database *****/ /***** Get data of comment from database *****/
if (TL_DB_GetDataOfCommByCod (Com->PubCod,&mysql_res)) if (Tml_DB_GetDataOfCommByCod (Com->PubCod,&mysql_res))
{ {
/* Get data of comment */ /* Get data of comment */
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
TL_Com_GetDataOfCommFromRow (row,Com); Tml_Com_GetDataOfCommFromRow (row,Com);
} }
else else
/* Reset fields of comment */ /* Reset fields of comment */
TL_Com_ResetComm (Com); Tml_Com_ResetComm (Com);
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
@ -1053,8 +1053,8 @@ void TL_Com_GetDataOfCommByCod (struct TL_Com_Comment *Com)
/********************** Get data of comment from row *************************/ /********************** Get data of comment from row *************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_GetDataOfCommFromRow (MYSQL_ROW row, static void Tml_Com_GetDataOfCommFromRow (MYSQL_ROW row,
struct TL_Com_Comment *Com) struct Tml_Com_Comment *Com)
{ {
/* /*
row[0]: PubCod row[0]: PubCod
@ -1079,7 +1079,7 @@ static void TL_Com_GetDataOfCommFromRow (MYSQL_ROW row,
Med_GetMediaDataByCod (&Com->Content.Media); Med_GetMediaDataByCod (&Com->Content.Media);
/***** Get number of times this comment has been favourited *****/ /***** Get number of times this comment has been favourited *****/
Com->NumFavs = TL_DB_GetNumFavers (TL_Usr_FAV_UNF_COMM, Com->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_COMM,
Com->PubCod,Com->UsrCod); Com->PubCod,Com->UsrCod);
} }
@ -1087,7 +1087,7 @@ static void TL_Com_GetDataOfCommFromRow (MYSQL_ROW row,
/************************** Reset fields of comment **************************/ /************************** Reset fields of comment **************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Com_ResetComm (struct TL_Com_Comment *Com) static void Tml_Com_ResetComm (struct Tml_Com_Comment *Com)
{ {
Com->PubCod = Com->PubCod =
Com->UsrCod = Com->UsrCod =

View File

@ -1,7 +1,7 @@
// swad_timeline.h: social timeline // swad_timeline.h: social timeline
#ifndef _SWAD_TL_COM #ifndef _SWAD_TML_COM
#define _SWAD_TL_COM #define _SWAD_TML_COM
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -38,43 +38,43 @@
/******************************** Public types *******************************/ /******************************** Public types *******************************/
/*****************************************************************************/ /*****************************************************************************/
struct TL_Com_Comment struct Tml_Com_Comment
{ {
long PubCod; // Unique code/identifier for each publication long PubCod; // Unique code/identifier for each publication
long UsrCod; // Publisher long UsrCod; // Publisher
long NotCod; // Note code to which this comment belongs long NotCod; // Note code to which this comment belongs
time_t DateTimeUTC; // Date-time of publication in UTC time time_t DateTimeUTC; // Date-time of publication in UTC time
unsigned NumFavs; // Number of times (users) this comment has been favourited unsigned NumFavs; // Number of times (users) this comment has been favourited
struct TL_Pst_Content Content; struct Tml_Pst_Content Content;
}; };
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Com_PutIconToToggleComm (const char UniqueId[Frm_MAX_BYTES_ID + 1]); void Tml_Com_PutIconToToggleComm (const char UniqueId[Frm_MAX_BYTES_ID + 1]);
void TL_Com_PutIconCommDisabled (void); void Tml_Com_PutIconCommDisabled (void);
void TL_Com_PutPhotoAndFormToWriteNewComm (const struct TL_Timeline *Timeline, void Tml_Com_PutPhotoAndFormToWriteNewComm (const struct Tml_Timeline *Timeline,
long NotCod, long NotCod,
const char IdNewComm[Frm_MAX_BYTES_ID + 1]); const char IdNewComm[Frm_MAX_BYTES_ID + 1]);
void TL_Com_WriteCommsInNote (const struct TL_Timeline *Timeline, void Tml_Com_WriteCommsInNote (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not); const struct Tml_Not_Note *Not);
void TL_Com_ShowHiddenCommsUsr (void); void Tml_Com_ShowHiddenCommsUsr (void);
void TL_Com_ShowHiddenCommsGbl (void); void Tml_Com_ShowHiddenCommsGbl (void);
void TL_Com_ReceiveCommUsr (void); void Tml_Com_ReceiveCommUsr (void);
void TL_Com_ReceiveCommGbl (void); void Tml_Com_ReceiveCommGbl (void);
void TL_Com_RequestRemComUsr (void); void Tml_Com_RequestRemComUsr (void);
void TL_Com_RequestRemComGbl (void); void Tml_Com_RequestRemComGbl (void);
void TL_Com_RemoveComUsr (void); void Tml_Com_RemoveComUsr (void);
void TL_Com_RemoveComGbl (void); void Tml_Com_RemoveComGbl (void);
void TL_Com_RemoveCommMediaAndDBEntries (long PubCod); void Tml_Com_RemoveCommMediaAndDBEntries (long PubCod);
void TL_Com_GetDataOfCommByCod (struct TL_Com_Comment *Com); void Tml_Com_GetDataOfCommByCod (struct Tml_Com_Comment *Com);
#endif #endif

View File

@ -40,23 +40,23 @@
/************************* Private constants and types ***********************/ /************************* Private constants and types ***********************/
/*****************************************************************************/ /*****************************************************************************/
static const char *TL_DB_TableFav[TL_Usr_NUM_FAV_SHA] = static const char *Tml_DB_TableFav[Tml_Usr_NUM_FAV_SHA] =
{ {
[TL_Usr_FAV_UNF_NOTE] = "tl_notes_fav", [Tml_Usr_FAV_UNF_NOTE] = "tl_notes_fav",
[TL_Usr_FAV_UNF_COMM] = "tl_comments_fav", [Tml_Usr_FAV_UNF_COMM] = "tl_comments_fav",
[TL_Usr_SHA_UNS_NOTE] = NULL, // Not used [Tml_Usr_SHA_UNS_NOTE] = NULL, // Not used
}; };
static const char *TL_DB_FieldFav[TL_Usr_NUM_FAV_SHA] = static const char *Tml_DB_FieldFav[Tml_Usr_NUM_FAV_SHA] =
{ {
[TL_Usr_FAV_UNF_NOTE] = "NotCod", [Tml_Usr_FAV_UNF_NOTE] = "NotCod",
[TL_Usr_FAV_UNF_COMM] = "PubCod", [Tml_Usr_FAV_UNF_COMM] = "PubCod",
[TL_Usr_SHA_UNS_NOTE] = NULL, // Not used [Tml_Usr_SHA_UNS_NOTE] = NULL, // Not used
}; };
static TL_Pub_PubType_t TL_DB_PubTypeFav[TL_Usr_NUM_FAV_SHA] = static Tml_Pub_PubType_t Tml_DB_PubTypeFav[Tml_Usr_NUM_FAV_SHA] =
{ {
[TL_Usr_FAV_UNF_NOTE] = TL_Pub_ORIGINAL_NOTE, [Tml_Usr_FAV_UNF_NOTE] = Tml_Pub_ORIGINAL_NOTE,
[TL_Usr_FAV_UNF_COMM] = TL_Pub_COMMENT_TO_NOTE, [Tml_Usr_FAV_UNF_COMM] = Tml_Pub_COMMENT_TO_NOTE,
[TL_Usr_SHA_UNS_NOTE] = TL_Pub_UNKNOWN, // Not used [Tml_Usr_SHA_UNS_NOTE] = Tml_Pub_UNKNOWN, // Not used
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -73,14 +73,14 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static long TL_DB_GetMedCod (const char *Table,const char *Field,long Cod); static long Tml_DB_GetMedCod (const char *Table,const char *Field,long Cod);
/*****************************************************************************/ /*****************************************************************************/
/********************* Get which users to show in timeline *******************/ /********************* Get which users to show in timeline *******************/
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got // Returns the number of rows got
unsigned TL_DB_GetWho (MYSQL_RES **mysql_res) unsigned Tml_DB_GetWho (MYSQL_RES **mysql_res)
{ {
/***** Get which users from database *****/ /***** Get which users from database *****/
return (unsigned) return (unsigned)
@ -94,7 +94,7 @@ unsigned TL_DB_GetWho (MYSQL_RES **mysql_res)
/********************* Get which users to show in timeline *******************/ /********************* Get which users to show in timeline *******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_UpdateWho (Usr_Who_t Who) void Tml_DB_UpdateWho (Usr_Who_t Who)
{ {
/***** Update which users in database *****/ /***** Update which users in database *****/
DB_QueryUPDATE ("can not update which timeline users", DB_QueryUPDATE ("can not update which timeline users",
@ -109,7 +109,7 @@ void TL_DB_UpdateWho (Usr_Who_t Who)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got // Returns the number of rows got
unsigned TL_DB_GetDataOfNoteByCod (long NotCod,MYSQL_RES **mysql_res) unsigned Tml_DB_GetDataOfNoteByCod (long NotCod,MYSQL_RES **mysql_res)
{ {
/***** Trivial check: note code should be > 0 *****/ /***** Trivial check: note code should be > 0 *****/
if (NotCod <= 0) if (NotCod <= 0)
@ -134,7 +134,7 @@ unsigned TL_DB_GetDataOfNoteByCod (long NotCod,MYSQL_RES **mysql_res)
/*************** Get code of publication of the original note ****************/ /*************** Get code of publication of the original note ****************/
/*****************************************************************************/ /*****************************************************************************/
long TL_DB_GetPubCodOfOriginalNote (long NotCod) long Tml_DB_GetPubCodOfOriginalNote (long NotCod)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -144,7 +144,7 @@ long TL_DB_GetPubCodOfOriginalNote (long NotCod)
if (DB_QuerySELECT (&mysql_res,"can not get code of publication", if (DB_QuerySELECT (&mysql_res,"can not get code of publication",
"SELECT PubCod FROM tl_pubs" "SELECT PubCod FROM tl_pubs"
" WHERE NotCod=%ld AND PubType=%u", " WHERE NotCod=%ld AND PubType=%u",
NotCod,(unsigned) TL_Pub_ORIGINAL_NOTE) == 1) NotCod,(unsigned) Tml_Pub_ORIGINAL_NOTE) == 1)
{ // Result should have a unique row { // Result should have a unique row
/* Get code of publication (row[0]) */ /* Get code of publication (row[0]) */
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
@ -162,8 +162,8 @@ long TL_DB_GetPubCodOfOriginalNote (long NotCod)
/*****************************************************************************/ /*****************************************************************************/
// Returns code of note just created // Returns code of note just created
long TL_DB_CreateNewNote (TL_Not_NoteType_t NoteType,long Cod, long Tml_DB_CreateNewNote (Tml_Not_NoteType_t NoteType,long Cod,
long PublisherCod,long HieCod) long PublisherCod,long HieCod)
{ {
return return
DB_QueryINSERTandReturnCode ("can not create new note", DB_QueryINSERTandReturnCode ("can not create new note",
@ -181,7 +181,7 @@ long TL_DB_CreateNewNote (TL_Not_NoteType_t NoteType,long Cod,
/************************* Mark a note as unavailable ************************/ /************************* Mark a note as unavailable ************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_MarkNoteAsUnavailable (TL_Not_NoteType_t NoteType,long Cod) void Tml_DB_MarkNoteAsUnavailable (Tml_Not_NoteType_t NoteType,long Cod)
{ {
/***** Mark note as unavailable *****/ /***** Mark note as unavailable *****/
DB_QueryUPDATE ("can not mark note as unavailable", DB_QueryUPDATE ("can not mark note as unavailable",
@ -194,10 +194,9 @@ void TL_DB_MarkNoteAsUnavailable (TL_Not_NoteType_t NoteType,long Cod)
/***** Mark possible notes involving children of a folder as unavailable *****/ /***** Mark possible notes involving children of a folder as unavailable *****/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_MarkNotesChildrenOfFolderAsUnavailable (TL_Not_NoteType_t NoteType, void Tml_DB_MarkNotesChildrenOfFolderAsUnavailable (Tml_Not_NoteType_t NoteType,
Brw_FileBrowser_t FileBrowser, Brw_FileBrowser_t FileBrowser,
long Cod, long Cod,const char *Path)
const char *Path)
{ {
/***** Mark notes as unavailable *****/ /***** Mark notes as unavailable *****/
DB_QueryUPDATE ("can not mark notes as unavailable", DB_QueryUPDATE ("can not mark notes as unavailable",
@ -215,7 +214,7 @@ void TL_DB_MarkNotesChildrenOfFolderAsUnavailable (TL_Not_NoteType_t NoteType,
/******* Create temporary tables used to not get notes already shown *********/ /******* Create temporary tables used to not get notes already shown *********/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_CreateTmpTableJustRetrievedNotes (void) void Tml_DB_CreateTmpTableJustRetrievedNotes (void)
{ {
/***** Create temporary table with notes just retrieved *****/ /***** Create temporary table with notes just retrieved *****/
DB_Query ("can not create temporary table", DB_Query ("can not create temporary table",
@ -224,7 +223,7 @@ void TL_DB_CreateTmpTableJustRetrievedNotes (void)
" ENGINE=MEMORY"); " ENGINE=MEMORY");
} }
void TL_DB_CreateTmpTableVisibleTimeline (void) void Tml_DB_CreateTmpTableVisibleTimeline (void)
{ {
/***** Create temporary table with all notes visible in timeline *****/ /***** Create temporary table with all notes visible in timeline *****/
DB_Query ("can not create temporary table", DB_Query ("can not create temporary table",
@ -239,7 +238,7 @@ void TL_DB_CreateTmpTableVisibleTimeline (void)
/**** Insert note in temporary tables used to not get notes already shown ****/ /**** Insert note in temporary tables used to not get notes already shown ****/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_InsertNoteInJustRetrievedNotes (long NotCod) void Tml_DB_InsertNoteInJustRetrievedNotes (long NotCod)
{ {
/* Insert note in temporary table with just retrieved notes. /* Insert note in temporary table with just retrieved notes.
This table will be used to not get notes already shown */ This table will be used to not get notes already shown */
@ -249,7 +248,7 @@ void TL_DB_InsertNoteInJustRetrievedNotes (long NotCod)
NotCod); NotCod);
} }
void TL_DB_InsertNoteInVisibleTimeline (long NotCod) void Tml_DB_InsertNoteInVisibleTimeline (long NotCod)
{ {
/* Insert note in temporary table with visible timeline. /* Insert note in temporary table with visible timeline.
This table will be used to not get notes already shown */ This table will be used to not get notes already shown */
@ -263,7 +262,7 @@ void TL_DB_InsertNoteInVisibleTimeline (long NotCod)
/****** Add just retrieved notes to current timeline for this session ********/ /****** Add just retrieved notes to current timeline for this session ********/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_AddNotesJustRetrievedToVisibleTimelineOfSession (void) void Tml_DB_AddNotesJustRetrievedToVisibleTimelineOfSession (void)
{ {
/* tl_timelines contains the distinct notes in timeline of each open session: /* tl_timelines contains the distinct notes in timeline of each open session:
mysql> SELECT SessionId,COUNT(*) FROM tl_timelines GROUP BY SessionId; mysql> SELECT SessionId,COUNT(*) FROM tl_timelines GROUP BY SessionId;
@ -294,14 +293,14 @@ mysql> SELECT SessionId,COUNT(*) FROM tl_timelines GROUP BY SessionId;
/******** Drop temporary tables used to not get notes already shown **********/ /******** Drop temporary tables used to not get notes already shown **********/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_DropTmpTableJustRetrievedNotes (void) void Tml_DB_DropTmpTableJustRetrievedNotes (void)
{ {
/***** Drop temporary table with notes just retrieved *****/ /***** Drop temporary table with notes just retrieved *****/
DB_Query ("can not remove temporary table", DB_Query ("can not remove temporary table",
"DROP TEMPORARY TABLE IF EXISTS tl_tmp_just_retrieved_notes"); "DROP TEMPORARY TABLE IF EXISTS tl_tmp_just_retrieved_notes");
} }
void TL_DB_DropTmpTableVisibleTimeline (void) void Tml_DB_DropTmpTableVisibleTimeline (void)
{ {
/***** Drop temporary table with all notes visible in timeline *****/ /***** Drop temporary table with all notes visible in timeline *****/
DB_Query ("can not remove temporary table", DB_Query ("can not remove temporary table",
@ -312,7 +311,7 @@ void TL_DB_DropTmpTableVisibleTimeline (void)
/******************* Clear unused old timelines in database ******************/ /******************* Clear unused old timelines in database ******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_ClearOldTimelinesNotesFromDB (void) void Tml_DB_ClearOldTimelinesNotesFromDB (void)
{ {
/***** Remove timelines for expired sessions *****/ /***** Remove timelines for expired sessions *****/
DB_QueryDELETE ("can not remove old timelines", DB_QueryDELETE ("can not remove old timelines",
@ -324,7 +323,7 @@ void TL_DB_ClearOldTimelinesNotesFromDB (void)
/***************** Clear timeline for a session in database ******************/ /***************** Clear timeline for a session in database ******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_ClearTimelineNotesOfSessionFromDB (void) void Tml_DB_ClearTimelineNotesOfSessionFromDB (void)
{ {
/***** Remove timeline for a session *****/ /***** Remove timeline for a session *****/
DB_QueryDELETE ("can not remove timeline", DB_QueryDELETE ("can not remove timeline",
@ -337,7 +336,7 @@ void TL_DB_ClearTimelineNotesOfSessionFromDB (void)
/*************************** Remove favs for a note **************************/ /*************************** Remove favs for a note **************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveNoteFavs (long NotCod) void Tml_DB_RemoveNoteFavs (long NotCod)
{ {
/***** Remove favs for note *****/ /***** Remove favs for note *****/
DB_QueryDELETE ("can not remove favs for note", DB_QueryDELETE ("can not remove favs for note",
@ -350,7 +349,7 @@ void TL_DB_RemoveNoteFavs (long NotCod)
/******************** Remove all publications of this note *******************/ /******************** Remove all publications of this note *******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveNotePubs (long NotCod) void Tml_DB_RemoveNotePubs (long NotCod)
{ {
/***** Remove all publications of this note *****/ /***** Remove all publications of this note *****/
DB_QueryDELETE ("can not remove a publication", DB_QueryDELETE ("can not remove a publication",
@ -363,7 +362,7 @@ void TL_DB_RemoveNotePubs (long NotCod)
/******************* Remove note publication from database *******************/ /******************* Remove note publication from database *******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveNote (long NotCod) void Tml_DB_RemoveNote (long NotCod)
{ {
/***** Remove note *****/ /***** Remove note *****/
DB_QueryDELETE ("can not remove a note", DB_QueryDELETE ("can not remove a note",
@ -378,7 +377,7 @@ void TL_DB_RemoveNote (long NotCod)
/******************** Remove all notes created by a user *********************/ /******************** Remove all notes created by a user *********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveAllNotesUsr (long UsrCod) void Tml_DB_RemoveAllNotesUsr (long UsrCod)
{ {
/***** Remove all notes created by user *****/ /***** Remove all notes created by user *****/
DB_QueryDELETE ("can not remove notes", DB_QueryDELETE ("can not remove notes",
@ -391,7 +390,7 @@ void TL_DB_RemoveAllNotesUsr (long UsrCod)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got // Returns the number of rows got
unsigned TL_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res) unsigned Tml_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res)
{ {
/***** Trivial check: post code should be > 0 *****/ /***** Trivial check: post code should be > 0 *****/
if (PstCod <= 0) if (PstCod <= 0)
@ -412,9 +411,9 @@ unsigned TL_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res)
/***************** Get code of media associated to post **********************/ /***************** Get code of media associated to post **********************/
/*****************************************************************************/ /*****************************************************************************/
long TL_DB_GetMedCodFromPost (long PstCod) long Tml_DB_GetMedCodFromPost (long PstCod)
{ {
return TL_DB_GetMedCod ("tl_posts","PstCod",PstCod); return Tml_DB_GetMedCod ("tl_posts","PstCod",PstCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -422,7 +421,7 @@ long TL_DB_GetMedCodFromPost (long PstCod)
/*****************************************************************************/ /*****************************************************************************/
// Returns code of just created post // Returns code of just created post
long TL_DB_CreateNewPost (const struct TL_Pst_Content *Content) long Tml_DB_CreateNewPost (const struct Tml_Pst_Content *Content)
{ {
/***** Insert post content in the database *****/ /***** Insert post content in the database *****/
return return
@ -439,7 +438,7 @@ long TL_DB_CreateNewPost (const struct TL_Pst_Content *Content)
/************************* Remove post from database *************************/ /************************* Remove post from database *************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemovePost (long PstCod) void Tml_DB_RemovePost (long PstCod)
{ {
/***** Remove post *****/ /***** Remove post *****/
DB_QueryDELETE ("can not remove a post", DB_QueryDELETE ("can not remove a post",
@ -452,7 +451,7 @@ void TL_DB_RemovePost (long PstCod)
/************************* Remove all posts of a user ************************/ /************************* Remove all posts of a user ************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveAllPostsUsr (long UsrCod) void Tml_DB_RemoveAllPostsUsr (long UsrCod)
{ {
/***** Remove all posts of the user *****/ /***** Remove all posts of the user *****/
DB_QueryDELETE ("can not remove posts", DB_QueryDELETE ("can not remove posts",
@ -467,13 +466,13 @@ void TL_DB_RemoveAllPostsUsr (long UsrCod)
/********************* Get number of comments in a note **********************/ /********************* Get number of comments in a note **********************/
/*****************************************************************************/ /*****************************************************************************/
unsigned TL_DB_GetNumCommsInNote (long NotCod) unsigned Tml_DB_GetNumCommsInNote (long NotCod)
{ {
return (unsigned) return (unsigned)
DB_QueryCOUNT ("can not get number of comments in a note", DB_QueryCOUNT ("can not get number of comments in a note",
"SELECT COUNT(*) FROM tl_pubs" "SELECT COUNT(*) FROM tl_pubs"
" WHERE NotCod=%ld AND PubType=%u", " WHERE NotCod=%ld AND PubType=%u",
NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -481,14 +480,14 @@ unsigned TL_DB_GetNumCommsInNote (long NotCod)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got // Returns the number of rows got
unsigned TL_DB_GetComms (long NotCod,MYSQL_RES **mysql_res) unsigned Tml_DB_GetComms (long NotCod,MYSQL_RES **mysql_res)
{ {
return (unsigned) return (unsigned)
DB_QuerySELECT (mysql_res,"can not get comments", DB_QuerySELECT (mysql_res,"can not get comments",
"SELECT PubCod" // row[0] "SELECT PubCod" // row[0]
" FROM tl_pubs" " FROM tl_pubs"
" WHERE NotCod=%ld AND PubType=%u", " WHERE NotCod=%ld AND PubType=%u",
NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -496,9 +495,8 @@ unsigned TL_DB_GetComms (long NotCod,MYSQL_RES **mysql_res)
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got // Returns the number of rows got
unsigned TL_DB_GetInitialComms (long NotCod, unsigned Tml_DB_GetInitialComms (long NotCod,unsigned NumInitialCommsToGet,
unsigned NumInitialCommsToGet, MYSQL_RES **mysql_res)
MYSQL_RES **mysql_res)
{ {
return (unsigned) return (unsigned)
DB_QuerySELECT (mysql_res,"can not get comments", DB_QuerySELECT (mysql_res,"can not get comments",
@ -514,7 +512,7 @@ unsigned TL_DB_GetInitialComms (long NotCod,
" AND tl_pubs.PubCod=tl_comments.PubCod" " AND tl_pubs.PubCod=tl_comments.PubCod"
" ORDER BY tl_pubs.PubCod" " ORDER BY tl_pubs.PubCod"
" LIMIT %lu", " LIMIT %lu",
NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE, NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE,
NumInitialCommsToGet); NumInitialCommsToGet);
} }
@ -523,8 +521,8 @@ unsigned TL_DB_GetInitialComms (long NotCod,
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got // Returns the number of rows got
unsigned TL_DB_GetFinalComms (long NotCod,unsigned NumFinalCommsToGet, unsigned Tml_DB_GetFinalComms (long NotCod,unsigned NumFinalCommsToGet,
MYSQL_RES **mysql_res) MYSQL_RES **mysql_res)
{ {
/***** Get final comments of a note from database *****/ /***** Get final comments of a note from database *****/
return (unsigned) return (unsigned)
@ -544,7 +542,7 @@ unsigned TL_DB_GetFinalComms (long NotCod,unsigned NumFinalCommsToGet,
" ORDER BY tl_pubs.PubCod DESC LIMIT %u" " ORDER BY tl_pubs.PubCod DESC LIMIT %u"
") AS comments" ") AS comments"
" ORDER BY PubCod", " ORDER BY PubCod",
NotCod,(unsigned) TL_Pub_COMMENT_TO_NOTE, NotCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE,
NumFinalCommsToGet); NumFinalCommsToGet);
} }
@ -553,7 +551,7 @@ unsigned TL_DB_GetFinalComms (long NotCod,unsigned NumFinalCommsToGet,
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got // Returns the number of rows got
unsigned TL_DB_GetDataOfCommByCod (long PubCod,MYSQL_RES **mysql_res) unsigned Tml_DB_GetDataOfCommByCod (long PubCod,MYSQL_RES **mysql_res)
{ {
/***** Trivial check: publication code should be > 0 *****/ /***** Trivial check: publication code should be > 0 *****/
if (PubCod <= 0) if (PubCod <= 0)
@ -572,15 +570,15 @@ unsigned TL_DB_GetDataOfCommByCod (long PubCod,MYSQL_RES **mysql_res)
" WHERE tl_pubs.PubCod=%ld" " WHERE tl_pubs.PubCod=%ld"
" AND tl_pubs.PubType=%u" " AND tl_pubs.PubType=%u"
" AND tl_pubs.PubCod=tl_comments.PubCod", " AND tl_pubs.PubCod=tl_comments.PubCod",
PubCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); PubCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
} }
/*****************************************************************************/ /*****************************************************************************/
/******************* Insert comment content in database **********************/ /******************* Insert comment content in database **********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_InsertCommContent (long PubCod, void Tml_DB_InsertCommContent (long PubCod,
const struct TL_Pst_Content *Content) const struct Tml_Pst_Content *Content)
{ {
/***** Insert comment content in database *****/ /***** Insert comment content in database *****/
DB_QueryINSERT ("can not store comment content", DB_QueryINSERT ("can not store comment content",
@ -597,16 +595,16 @@ void TL_DB_InsertCommContent (long PubCod,
/**************** Get code of media associated to comment ********************/ /**************** Get code of media associated to comment ********************/
/*****************************************************************************/ /*****************************************************************************/
long TL_DB_GetMedCodFromComm (long PubCod) long Tml_DB_GetMedCodFromComm (long PubCod)
{ {
return TL_DB_GetMedCod ("tl_comments","PubCod",PubCod); return Tml_DB_GetMedCod ("tl_comments","PubCod",PubCod);
} }
/*****************************************************************************/ /*****************************************************************************/
/****************** Remove favs for comment from database ********************/ /****************** Remove favs for comment from database ********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveCommFavs (long PubCod) void Tml_DB_RemoveCommFavs (long PubCod)
{ {
/***** Remove favs for comment *****/ /***** Remove favs for comment *****/
DB_QueryDELETE ("can not remove favs for comment", DB_QueryDELETE ("can not remove favs for comment",
@ -619,7 +617,7 @@ void TL_DB_RemoveCommFavs (long PubCod)
/***************** Remove content of comment from database *******************/ /***************** Remove content of comment from database *******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveCommContent (long PubCod) void Tml_DB_RemoveCommContent (long PubCod)
{ {
/***** Remove content of comment *****/ /***** Remove content of comment *****/
DB_QueryDELETE ("can not remove comment content", DB_QueryDELETE ("can not remove comment content",
@ -632,7 +630,7 @@ void TL_DB_RemoveCommContent (long PubCod)
/***************** Remove comment publication from database ******************/ /***************** Remove comment publication from database ******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveCommPub (long PubCod) void Tml_DB_RemoveCommPub (long PubCod)
{ {
/***** Remove comment publication *****/ /***** Remove comment publication *****/
DB_QueryDELETE ("can not remove comment", DB_QueryDELETE ("can not remove comment",
@ -642,14 +640,14 @@ void TL_DB_RemoveCommPub (long PubCod)
" AND PubType=%u", // Extra check: it's a comment " AND PubType=%u", // Extra check: it's a comment
PubCod, PubCod,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) TL_Pub_COMMENT_TO_NOTE); (unsigned) Tml_Pub_COMMENT_TO_NOTE);
} }
/*****************************************************************************/ /*****************************************************************************/
/*********** Remove all comments in all the notes of a given user ************/ /*********** Remove all comments in all the notes of a given user ************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveAllCommsInAllNotesOf (long UsrCod) void Tml_DB_RemoveAllCommsInAllNotesOf (long UsrCod)
{ {
/***** Remove all comments in all notes of the user *****/ /***** Remove all comments in all notes of the user *****/
DB_QueryDELETE ("can not remove comments", DB_QueryDELETE ("can not remove comments",
@ -659,14 +657,14 @@ void TL_DB_RemoveAllCommsInAllNotesOf (long UsrCod)
" AND tl_notes.NotCod=tl_pubs.NotCod" " AND tl_notes.NotCod=tl_pubs.NotCod"
" AND tl_pubs.PubType=%u" " AND tl_pubs.PubType=%u"
" AND tl_pubs.PubCod=tl_comments.PubCod", " AND tl_pubs.PubCod=tl_comments.PubCod",
UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); UsrCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
} }
/*****************************************************************************/ /*****************************************************************************/
/*********** Remove all comments made by a given user in any note ************/ /*********** Remove all comments made by a given user in any note ************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveAllCommsMadeBy (long UsrCod) void Tml_DB_RemoveAllCommsMadeBy (long UsrCod)
{ {
/***** Remove all comments made by this user in any note *****/ /***** Remove all comments made by this user in any note *****/
DB_QueryDELETE ("can not remove comments", DB_QueryDELETE ("can not remove comments",
@ -675,14 +673,14 @@ void TL_DB_RemoveAllCommsMadeBy (long UsrCod)
" WHERE tl_pubs.PublisherCod=%ld" " WHERE tl_pubs.PublisherCod=%ld"
" AND tl_pubs.PubType=%u" " AND tl_pubs.PubType=%u"
" AND tl_pubs.PubCod=tl_comments.PubCod", " AND tl_pubs.PubCod=tl_comments.PubCod",
UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); UsrCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
} }
/*****************************************************************************/ /*****************************************************************************/
/*************** Get code of media associated to post/comment ****************/ /*************** Get code of media associated to post/comment ****************/
/*****************************************************************************/ /*****************************************************************************/
static long TL_DB_GetMedCod (const char *Table,const char *Field,long Cod) static long Tml_DB_GetMedCod (const char *Table,const char *Field,long Cod)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -710,18 +708,18 @@ static long TL_DB_GetMedCod (const char *Table,const char *Field,long Cod)
/******* Create temporary table and subquery with potential publishers *******/ /******* Create temporary table and subquery with potential publishers *******/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_CreateSubQueryPublishers (const struct TL_Timeline *Timeline, void Tml_DB_CreateSubQueryPublishers (const struct Tml_Timeline *Timeline,
struct TL_Pub_SubQueries *SubQueries) struct Tml_Pub_SubQueries *SubQueries)
{ {
/***** Create temporary table and subquery with potential publishers *****/ /***** Create temporary table and subquery with potential publishers *****/
switch (Timeline->UsrOrGbl) switch (Timeline->UsrOrGbl)
{ {
case TL_Usr_TIMELINE_USR: // Show the timeline of a user case Tml_Usr_TIMELINE_USR: // Show the timeline of a user
SubQueries->TablePublishers = ""; SubQueries->TablePublishers = "";
sprintf (SubQueries->Publishers,"tl_pubs.PublisherCod=%ld AND ", sprintf (SubQueries->Publishers,"tl_pubs.PublisherCod=%ld AND ",
Gbl.Usrs.Other.UsrDat.UsrCod); Gbl.Usrs.Other.UsrDat.UsrCod);
break; break;
case TL_Usr_TIMELINE_GBL: // Show the global timeline case Tml_Usr_TIMELINE_GBL: // Show the global timeline
switch (Timeline->Who) switch (Timeline->Who)
{ {
case Usr_WHO_ME: // Show my timeline case Usr_WHO_ME: // Show my timeline
@ -753,14 +751,14 @@ void TL_DB_CreateSubQueryPublishers (const struct TL_Timeline *Timeline,
/********* Create subquery to get only notes not present in timeline *********/ /********* Create subquery to get only notes not present in timeline *********/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_CreateSubQueryAlreadyExists (const struct TL_Timeline *Timeline, void Tml_DB_CreateSubQueryAlreadyExists (const struct Tml_Timeline *Timeline,
struct TL_Pub_SubQueries *SubQueries) struct Tml_Pub_SubQueries *SubQueries)
{ {
static const char *Table[TL_NUM_WHAT_TO_GET] = static const char *Table[Tml_NUM_WHAT_TO_GET] =
{ {
[TL_GET_RECENT_TIMELINE] = "tl_tmp_just_retrieved_notes", // Avoid notes just retrieved [Tml_GET_RECENT_TIMELINE] = "tl_tmp_just_retrieved_notes", // Avoid notes just retrieved
[TL_GET_ONLY_NEW_PUBS ] = "tl_tmp_just_retrieved_notes", // Avoid notes just retrieved [Tml_GET_ONLY_NEW_PUBS ] = "tl_tmp_just_retrieved_notes", // Avoid notes just retrieved
[TL_GET_ONLY_OLD_PUBS ] = "tl_tmp_visible_timeline", // Avoid notes already shown [Tml_GET_ONLY_OLD_PUBS ] = "tl_tmp_visible_timeline", // Avoid notes already shown
}; };
snprintf (SubQueries->AlreadyExists,sizeof (SubQueries->AlreadyExists), snprintf (SubQueries->AlreadyExists,sizeof (SubQueries->AlreadyExists),
@ -772,7 +770,7 @@ void TL_DB_CreateSubQueryAlreadyExists (const struct TL_Timeline *Timeline,
/***** Create subqueries with range of publications to get from tl_pubs ******/ /***** Create subqueries with range of publications to get from tl_pubs ******/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_CreateSubQueryRangeBottom (long Bottom,struct TL_Pub_SubQueries *SubQueries) void Tml_DB_CreateSubQueryRangeBottom (long Bottom,struct Tml_Pub_SubQueries *SubQueries)
{ {
if (Bottom > 0) if (Bottom > 0)
sprintf (SubQueries->RangeBottom,"tl_pubs.PubCod>%ld AND ",Bottom); sprintf (SubQueries->RangeBottom,"tl_pubs.PubCod>%ld AND ",Bottom);
@ -780,7 +778,7 @@ void TL_DB_CreateSubQueryRangeBottom (long Bottom,struct TL_Pub_SubQueries *SubQ
SubQueries->RangeBottom[0] = '\0'; SubQueries->RangeBottom[0] = '\0';
} }
void TL_DB_CreateSubQueryRangeTop (long Top,struct TL_Pub_SubQueries *SubQueries) void Tml_DB_CreateSubQueryRangeTop (long Top,struct Tml_Pub_SubQueries *SubQueries)
{ {
if (Top > 0) if (Top > 0)
sprintf (SubQueries->RangeTop,"tl_pubs.PubCod<%ld AND ",Top); sprintf (SubQueries->RangeTop,"tl_pubs.PubCod<%ld AND ",Top);
@ -793,8 +791,8 @@ void TL_DB_CreateSubQueryRangeTop (long Top,struct TL_Pub_SubQueries *SubQueries
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got // Returns the number of rows got
unsigned TL_DB_SelectTheMostRecentPub (const struct TL_Pub_SubQueries *SubQueries, unsigned Tml_DB_SelectTheMostRecentPub (const struct Tml_Pub_SubQueries *SubQueries,
MYSQL_RES **mysql_res) MYSQL_RES **mysql_res)
{ {
return (unsigned) return (unsigned)
DB_QuerySELECT (mysql_res,"can not get publication", DB_QuerySELECT (mysql_res,"can not get publication",
@ -817,7 +815,7 @@ unsigned TL_DB_SelectTheMostRecentPub (const struct TL_Pub_SubQueries *SubQuerie
/*****************************************************************************/ /*****************************************************************************/
// Returns the number of rows got // Returns the number of rows got
unsigned TL_DB_GetDataOfPubByCod (long PubCod,MYSQL_RES **mysql_res) unsigned Tml_DB_GetDataOfPubByCod (long PubCod,MYSQL_RES **mysql_res)
{ {
/***** Trivial check: publication code should be > 0 *****/ /***** Trivial check: publication code should be > 0 *****/
if (PubCod <= 0) if (PubCod <= 0)
@ -838,7 +836,7 @@ unsigned TL_DB_GetDataOfPubByCod (long PubCod,MYSQL_RES **mysql_res)
/*********************** Get code of note of a publication *******************/ /*********************** Get code of note of a publication *******************/
/*****************************************************************************/ /*****************************************************************************/
long TL_DB_GetNotCodFromPubCod (long PubCod) long Tml_DB_GetNotCodFromPubCod (long PubCod)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -868,7 +866,7 @@ long TL_DB_GetNotCodFromPubCod (long PubCod)
// "LastPubCod" // "LastPubCod"
// "FirstPubCod" // "FirstPubCod"
long TL_DB_GetPubCodFromSession (const char *FieldName) long Tml_DB_GetPubCodFromSession (const char *FieldName)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -898,7 +896,7 @@ long TL_DB_GetPubCodFromSession (const char *FieldName)
/****************** Get number of publications from a user *******************/ /****************** Get number of publications from a user *******************/
/*****************************************************************************/ /*****************************************************************************/
unsigned long TL_DB_GetNumPubsUsr (long UsrCod) unsigned long Tml_DB_GetNumPubsUsr (long UsrCod)
{ {
/***** Get number of posts from a user from database *****/ /***** Get number of posts from a user from database *****/
return DB_QueryCOUNT ("can not get number of publications from a user", return DB_QueryCOUNT ("can not get number of publications from a user",
@ -912,7 +910,7 @@ unsigned long TL_DB_GetNumPubsUsr (long UsrCod)
/*****************************************************************************/ /*****************************************************************************/
// Return just created publication code // Return just created publication code
long TL_DB_CreateNewPub (const struct TL_Pub_Publication *Pub) long Tml_DB_CreateNewPub (const struct Tml_Pub_Publication *Pub)
{ {
/***** Insert new publication in database *****/ /***** Insert new publication in database *****/
return return
@ -930,7 +928,7 @@ long TL_DB_CreateNewPub (const struct TL_Pub_Publication *Pub)
/************** Update first publication code stored in session **************/ /************** Update first publication code stored in session **************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_UpdateFirstPubCodInSession (long FirstPubCod) void Tml_DB_UpdateFirstPubCodInSession (long FirstPubCod)
{ {
DB_QueryUPDATE ("can not update first publication code into session", DB_QueryUPDATE ("can not update first publication code into session",
"UPDATE sessions" "UPDATE sessions"
@ -944,7 +942,7 @@ void TL_DB_UpdateFirstPubCodInSession (long FirstPubCod)
/*************** Update last publication code stored in session **************/ /*************** Update last publication code stored in session **************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_UpdateLastPubCodInSession (void) void Tml_DB_UpdateLastPubCodInSession (void)
{ {
DB_QueryUPDATE ("can not update last publication code into session", DB_QueryUPDATE ("can not update last publication code into session",
"UPDATE sessions" "UPDATE sessions"
@ -959,7 +957,7 @@ void TL_DB_UpdateLastPubCodInSession (void)
/********* Update first and last publication codes stored in session *********/ /********* Update first and last publication codes stored in session *********/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod) void Tml_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod)
{ {
DB_QueryUPDATE ("can not update first/last publication codes into session", DB_QueryUPDATE ("can not update first/last publication codes into session",
"UPDATE sessions" "UPDATE sessions"
@ -977,7 +975,7 @@ void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod)
/************** related to notes authored by a given user ****************/ /************** related to notes authored by a given user ****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (long UsrCod) void Tml_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (long UsrCod)
{ {
/***** Remove all publications (original notes, shared notes, comments) /***** Remove all publications (original notes, shared notes, comments)
published by any user published by any user
@ -994,7 +992,7 @@ void TL_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (long UsrCod)
/**************** Remove all publications published by a user ****************/ /**************** Remove all publications published by a user ****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveAllPubsPublishedBy (long UsrCod) void Tml_DB_RemoveAllPubsPublishedBy (long UsrCod)
{ {
/***** Remove all publications published by the user *****/ /***** Remove all publications published by the user *****/
DB_QueryDELETE ("can not remove publications", DB_QueryDELETE ("can not remove publications",
@ -1006,21 +1004,21 @@ void TL_DB_RemoveAllPubsPublishedBy (long UsrCod)
/****************** Check if a user has favourited a note ********************/ /****************** Check if a user has favourited a note ********************/
/*****************************************************************************/ /*****************************************************************************/
bool TL_DB_CheckIfFavedByUsr (TL_Usr_FavSha_t FavSha,long Cod,long UsrCod) bool Tml_DB_CheckIfFavedByUsr (Tml_Usr_FavSha_t FavSha,long Cod,long UsrCod)
{ {
/***** Check if a user has favourited a note/comment from database *****/ /***** Check if a user has favourited a note/comment from database *****/
return (DB_QueryCOUNT ("can not check if a user has favourited", return (DB_QueryCOUNT ("can not check if a user has favourited",
"SELECT COUNT(*) FROM %s" "SELECT COUNT(*) FROM %s"
" WHERE %s=%ld AND UsrCod=%ld", " WHERE %s=%ld AND UsrCod=%ld",
TL_DB_TableFav[FavSha], Tml_DB_TableFav[FavSha],
TL_DB_FieldFav[FavSha],Cod,UsrCod) != 0); Tml_DB_FieldFav[FavSha],Cod,UsrCod) != 0);
} }
/*****************************************************************************/ /*****************************************************************************/
/********* Get number of times a note/comment has been favourited ************/ /********* Get number of times a note/comment has been favourited ************/
/*****************************************************************************/ /*****************************************************************************/
unsigned TL_DB_GetNumFavers (TL_Usr_FavSha_t FavSha,long Cod,long UsrCod) unsigned Tml_DB_GetNumFavers (Tml_Usr_FavSha_t FavSha,long Cod,long UsrCod)
{ {
/***** Get number of times (users) a note/comment has been favourited *****/ /***** Get number of times (users) a note/comment has been favourited *****/
return (unsigned) return (unsigned)
@ -1028,8 +1026,8 @@ unsigned TL_DB_GetNumFavers (TL_Usr_FavSha_t FavSha,long Cod,long UsrCod)
"SELECT COUNT(*) FROM %s" "SELECT COUNT(*) FROM %s"
" WHERE %s=%ld" " WHERE %s=%ld"
" AND UsrCod<>%ld", // Extra check " AND UsrCod<>%ld", // Extra check
TL_DB_TableFav[FavSha], Tml_DB_TableFav[FavSha],
TL_DB_FieldFav[FavSha],Cod, Tml_DB_FieldFav[FavSha],Cod,
UsrCod); // The author UsrCod); // The author
} }
@ -1037,9 +1035,9 @@ unsigned TL_DB_GetNumFavers (TL_Usr_FavSha_t FavSha,long Cod,long UsrCod)
/******* Get list of users who have marked a note/comment as favourite *******/ /******* Get list of users who have marked a note/comment as favourite *******/
/*****************************************************************************/ /*****************************************************************************/
unsigned TL_DB_GetFavers (TL_Usr_FavSha_t FavSha, unsigned Tml_DB_GetFavers (Tml_Usr_FavSha_t FavSha,
long Cod,long UsrCod,unsigned MaxUsrs, long Cod,long UsrCod,unsigned MaxUsrs,
MYSQL_RES **mysql_res) MYSQL_RES **mysql_res)
{ {
/***** Get list of users who have marked a note/comment as favourite from database *****/ /***** Get list of users who have marked a note/comment as favourite from database *****/
return (unsigned) return (unsigned)
@ -1049,8 +1047,8 @@ unsigned TL_DB_GetFavers (TL_Usr_FavSha_t FavSha,
" WHERE %s=%ld" " WHERE %s=%ld"
" AND UsrCod<>%ld" // Extra check " AND UsrCod<>%ld" // Extra check
" ORDER BY FavCod LIMIT %u", " ORDER BY FavCod LIMIT %u",
TL_DB_TableFav[FavSha], Tml_DB_TableFav[FavSha],
TL_DB_FieldFav[FavSha],Cod, Tml_DB_FieldFav[FavSha],Cod,
UsrCod, UsrCod,
MaxUsrs); MaxUsrs);
} }
@ -1059,7 +1057,7 @@ unsigned TL_DB_GetFavers (TL_Usr_FavSha_t FavSha,
/**************** Mark note/comment as favourite in database *****************/ /**************** Mark note/comment as favourite in database *****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_MarkAsFav (TL_Usr_FavSha_t FavSha,long Cod) void Tml_DB_MarkAsFav (Tml_Usr_FavSha_t FavSha,long Cod)
{ {
/***** Insert in favourited in database *****/ /***** Insert in favourited in database *****/
DB_QueryINSERT ("can not favourite comment", DB_QueryINSERT ("can not favourite comment",
@ -1067,8 +1065,8 @@ void TL_DB_MarkAsFav (TL_Usr_FavSha_t FavSha,long Cod)
" (%s,UsrCod,TimeFav)" " (%s,UsrCod,TimeFav)"
" VALUES" " VALUES"
" (%ld,%ld,NOW())", " (%ld,%ld,NOW())",
TL_DB_TableFav[FavSha], Tml_DB_TableFav[FavSha],
TL_DB_FieldFav[FavSha], Tml_DB_FieldFav[FavSha],
Cod,Gbl.Usrs.Me.UsrDat.UsrCod); Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
@ -1076,33 +1074,33 @@ void TL_DB_MarkAsFav (TL_Usr_FavSha_t FavSha,long Cod)
/*************** Unmark note/comment as favourite in database ****************/ /*************** Unmark note/comment as favourite in database ****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_UnmarkAsFav (TL_Usr_FavSha_t FavSha,long Cod) void Tml_DB_UnmarkAsFav (Tml_Usr_FavSha_t FavSha,long Cod)
{ {
/***** Delete the mark as favourite from database *****/ /***** Delete the mark as favourite from database *****/
DB_QueryDELETE ("can not unfavourite", DB_QueryDELETE ("can not unfavourite",
"DELETE FROM %s" "DELETE FROM %s"
" WHERE %s=%ld AND UsrCod=%ld", " WHERE %s=%ld AND UsrCod=%ld",
TL_DB_TableFav[FavSha], Tml_DB_TableFav[FavSha],
TL_DB_FieldFav[FavSha],Cod,Gbl.Usrs.Me.UsrDat.UsrCod); Tml_DB_FieldFav[FavSha],Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
/********** Remove all favs made by a given user to any comment **************/ /********** Remove all favs made by a given user to any comment **************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveAllFavsMadeByUsr (TL_Usr_FavSha_t FavSha,long UsrCod) void Tml_DB_RemoveAllFavsMadeByUsr (Tml_Usr_FavSha_t FavSha,long UsrCod)
{ {
/* Remove all favs made by this user to any note/comment */ /* Remove all favs made by this user to any note/comment */
DB_QueryDELETE ("can not remove favs", DB_QueryDELETE ("can not remove favs",
"DELETE FROM %s WHERE UsrCod=%ld", "DELETE FROM %s WHERE UsrCod=%ld",
TL_DB_TableFav[FavSha],UsrCod); Tml_DB_TableFav[FavSha],UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
/************ Remove all favs to notes/comments of a given user **************/ /************ Remove all favs to notes/comments of a given user **************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveAllFavsToPubsBy (TL_Usr_FavSha_t FavSha,long UsrCod) void Tml_DB_RemoveAllFavsToPubsBy (Tml_Usr_FavSha_t FavSha,long UsrCod)
{ {
/***** Remove all favs to notes/comments of this user *****/ /***** Remove all favs to notes/comments of this user *****/
DB_QueryDELETE ("can not remove favs", DB_QueryDELETE ("can not remove favs",
@ -1111,18 +1109,18 @@ void TL_DB_RemoveAllFavsToPubsBy (TL_Usr_FavSha_t FavSha,long UsrCod)
" WHERE tl_pubs.PublisherCod=%ld" // Author of the comment " WHERE tl_pubs.PublisherCod=%ld" // Author of the comment
" AND tl_pubs.PubType=%u" " AND tl_pubs.PubType=%u"
" AND tl_pubs.PubCod=%s.PubCod", " AND tl_pubs.PubCod=%s.PubCod",
TL_DB_TableFav[FavSha], Tml_DB_TableFav[FavSha],
TL_DB_TableFav[FavSha], Tml_DB_TableFav[FavSha],
UsrCod, UsrCod,
(unsigned) TL_DB_PubTypeFav[FavSha], (unsigned) Tml_DB_PubTypeFav[FavSha],
TL_DB_TableFav[FavSha]); Tml_DB_TableFav[FavSha]);
} }
/*****************************************************************************/ /*****************************************************************************/
/*** Remove all favs to all comments in all notes authored by a given user ***/ /*** Remove all favs to all comments in all notes authored by a given user ***/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveAllFavsToAllCommsInAllNotesBy (long UsrCod) void Tml_DB_RemoveAllFavsToAllCommsInAllNotesBy (long UsrCod)
{ {
/***** Remove all favs to all comments /***** Remove all favs to all comments
in all notes authored by this user *****/ in all notes authored by this user *****/
@ -1133,14 +1131,14 @@ void TL_DB_RemoveAllFavsToAllCommsInAllNotesBy (long UsrCod)
" AND tl_notes.NotCod=tl_pubs.NotCod" " AND tl_notes.NotCod=tl_pubs.NotCod"
" AND tl_pubs.PubType=%u" " AND tl_pubs.PubType=%u"
" AND tl_pubs.PubCod=tl_comments_fav.PubCod", " AND tl_pubs.PubCod=tl_comments_fav.PubCod",
UsrCod,(unsigned) TL_Pub_COMMENT_TO_NOTE); UsrCod,(unsigned) Tml_Pub_COMMENT_TO_NOTE);
} }
/*****************************************************************************/ /*****************************************************************************/
/****************** Check if a user has published a note *********************/ /****************** Check if a user has published a note *********************/
/*****************************************************************************/ /*****************************************************************************/
bool TL_DB_CheckIfSharedByUsr (long NotCod,long UsrCod) bool Tml_DB_CheckIfSharedByUsr (long NotCod,long UsrCod)
{ {
return (DB_QueryCOUNT ("can not check if a user has shared a note", return (DB_QueryCOUNT ("can not check if a user has shared a note",
"SELECT COUNT(*) FROM tl_pubs" "SELECT COUNT(*) FROM tl_pubs"
@ -1149,14 +1147,14 @@ bool TL_DB_CheckIfSharedByUsr (long NotCod,long UsrCod)
" AND PubType=%u", " AND PubType=%u",
NotCod, NotCod,
UsrCod, UsrCod,
(unsigned) TL_Pub_SHARED_NOTE) != 0); (unsigned) Tml_Pub_SHARED_NOTE) != 0);
} }
/*****************************************************************************/ /*****************************************************************************/
/********** Get number of times a note has been shared in timeline ***********/ /********** Get number of times a note has been shared in timeline ***********/
/*****************************************************************************/ /*****************************************************************************/
unsigned TL_DB_GetNumSharers (long NotCod,long UsrCod) unsigned Tml_DB_GetNumSharers (long NotCod,long UsrCod)
{ {
/***** Get number of times (users) this note has been shared *****/ /***** Get number of times (users) this note has been shared *****/
return (unsigned) return (unsigned)
@ -1167,15 +1165,15 @@ unsigned TL_DB_GetNumSharers (long NotCod,long UsrCod)
" AND PubType=%u", " AND PubType=%u",
NotCod, NotCod,
UsrCod, // Author of the note UsrCod, // Author of the note
(unsigned) TL_Pub_SHARED_NOTE); (unsigned) Tml_Pub_SHARED_NOTE);
} }
/*****************************************************************************/ /*****************************************************************************/
/***************** Get list of users who have shared a note ******************/ /***************** Get list of users who have shared a note ******************/
/*****************************************************************************/ /*****************************************************************************/
unsigned TL_DB_GetSharers (long NotCod,long UsrCod,unsigned MaxUsrs, unsigned Tml_DB_GetSharers (long NotCod,long UsrCod,unsigned MaxUsrs,
MYSQL_RES **mysql_res) MYSQL_RES **mysql_res)
{ {
/***** Get list of users who have shared a note from database *****/ /***** Get list of users who have shared a note from database *****/
return (unsigned) return (unsigned)
@ -1188,7 +1186,7 @@ unsigned TL_DB_GetSharers (long NotCod,long UsrCod,unsigned MaxUsrs,
" ORDER BY PubCod LIMIT %u", " ORDER BY PubCod LIMIT %u",
NotCod, NotCod,
UsrCod, UsrCod,
(unsigned) TL_Pub_SHARED_NOTE, (unsigned) Tml_Pub_SHARED_NOTE,
MaxUsrs); MaxUsrs);
} }
@ -1196,7 +1194,7 @@ unsigned TL_DB_GetSharers (long NotCod,long UsrCod,unsigned MaxUsrs,
/****************** Remove shared publication from database ******************/ /****************** Remove shared publication from database ******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_DB_RemoveSharedPub (long NotCod) void Tml_DB_RemoveSharedPub (long NotCod)
{ {
/***** Remove shared publication *****/ /***** Remove shared publication *****/
DB_QueryDELETE ("can not remove a publication", DB_QueryDELETE ("can not remove a publication",
@ -1206,5 +1204,5 @@ void TL_DB_RemoveSharedPub (long NotCod)
" AND PubType=%u", // Extra check: shared note " AND PubType=%u", // Extra check: shared note
NotCod, NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod,
(unsigned) TL_Pub_SHARED_NOTE); (unsigned) Tml_Pub_SHARED_NOTE);
} }

View File

@ -1,7 +1,7 @@
// swad_timeline_database.h: social timeline operations with database // swad_timeline_database.h: social timeline operations with database
#ifndef _SWAD_TL_DB #ifndef _SWAD_TML_DB
#define _SWAD_TL_DB #define _SWAD_TML_DB
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -48,95 +48,93 @@
/*****************************************************************************/ /*****************************************************************************/
/****************************** Timeline from who ****************************/ /****************************** Timeline from who ****************************/
unsigned TL_DB_GetWho (MYSQL_RES **mysql_res); unsigned Tml_DB_GetWho (MYSQL_RES **mysql_res);
void TL_DB_UpdateWho (Usr_Who_t Who); void Tml_DB_UpdateWho (Usr_Who_t Who);
/*********************************** Notes ***********************************/ /*********************************** Notes ***********************************/
unsigned TL_DB_GetDataOfNoteByCod (long NotCod,MYSQL_RES **mysql_res); unsigned Tml_DB_GetDataOfNoteByCod (long NotCod,MYSQL_RES **mysql_res);
long TL_DB_GetPubCodOfOriginalNote (long NotCod); long Tml_DB_GetPubCodOfOriginalNote (long NotCod);
long TL_DB_CreateNewNote (TL_Not_NoteType_t NoteType,long Cod, long Tml_DB_CreateNewNote (Tml_Not_NoteType_t NoteType,long Cod,
long PublisherCod,long HieCod); long PublisherCod,long HieCod);
void TL_DB_MarkNoteAsUnavailable (TL_Not_NoteType_t NoteType,long Cod); void Tml_DB_MarkNoteAsUnavailable (Tml_Not_NoteType_t NoteType,long Cod);
void TL_DB_MarkNotesChildrenOfFolderAsUnavailable (TL_Not_NoteType_t NoteType, void Tml_DB_MarkNotesChildrenOfFolderAsUnavailable (Tml_Not_NoteType_t NoteType,
Brw_FileBrowser_t FileBrowser, Brw_FileBrowser_t FileBrowser,
long Cod, long Cod,const char *Path);
const char *Path); void Tml_DB_CreateTmpTableJustRetrievedNotes (void);
void TL_DB_CreateTmpTableJustRetrievedNotes (void); void Tml_DB_CreateTmpTableVisibleTimeline (void);
void TL_DB_CreateTmpTableVisibleTimeline (void); void Tml_DB_InsertNoteInJustRetrievedNotes (long NotCod);
void TL_DB_InsertNoteInJustRetrievedNotes (long NotCod); void Tml_DB_InsertNoteInVisibleTimeline (long NotCod);
void TL_DB_InsertNoteInVisibleTimeline (long NotCod); void Tml_DB_AddNotesJustRetrievedToVisibleTimelineOfSession (void);
void TL_DB_AddNotesJustRetrievedToVisibleTimelineOfSession (void); void Tml_DB_DropTmpTableJustRetrievedNotes (void);
void TL_DB_DropTmpTableJustRetrievedNotes (void); void Tml_DB_DropTmpTableVisibleTimeline (void);
void TL_DB_DropTmpTableVisibleTimeline (void); void Tml_DB_ClearOldTimelinesNotesFromDB (void);
void TL_DB_ClearOldTimelinesNotesFromDB (void); void Tml_DB_ClearTimelineNotesOfSessionFromDB (void);
void TL_DB_ClearTimelineNotesOfSessionFromDB (void); void Tml_DB_RemoveNoteFavs (long NotCod);
void TL_DB_RemoveNoteFavs (long NotCod); void Tml_DB_RemoveNotePubs (long NotCod);
void TL_DB_RemoveNotePubs (long NotCod); void Tml_DB_RemoveNote (long NotCod);
void TL_DB_RemoveNote (long NotCod); void Tml_DB_RemoveAllNotesUsr (long UsrCod);
void TL_DB_RemoveAllNotesUsr (long UsrCod);
/********************************* Posts *************************************/ /********************************* Posts *************************************/
unsigned TL_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res); unsigned Tml_DB_GetPostByCod (long PstCod,MYSQL_RES **mysql_res);
long TL_DB_GetMedCodFromPost (long PubCod); long Tml_DB_GetMedCodFromPost (long PubCod);
long TL_DB_CreateNewPost (const struct TL_Pst_Content *Content); long Tml_DB_CreateNewPost (const struct Tml_Pst_Content *Content);
void TL_DB_RemovePost (long PstCod); void Tml_DB_RemovePost (long PstCod);
void TL_DB_RemoveAllPostsUsr (long UsrCod); void Tml_DB_RemoveAllPostsUsr (long UsrCod);
/******************************** Comments ***********************************/ /******************************** Comments ***********************************/
unsigned TL_DB_GetNumCommsInNote (long NotCod); unsigned Tml_DB_GetNumCommsInNote (long NotCod);
unsigned TL_DB_GetComms (long NotCod,MYSQL_RES **mysql_res); unsigned Tml_DB_GetComms (long NotCod,MYSQL_RES **mysql_res);
unsigned TL_DB_GetInitialComms (long NotCod, unsigned Tml_DB_GetInitialComms (long NotCod,unsigned NumInitialCommsToGet,
unsigned NumInitialCommsToGet, MYSQL_RES **mysql_res);
MYSQL_RES **mysql_res); unsigned Tml_DB_GetFinalComms (long NotCod,unsigned NumFinalCommsToGet,
unsigned TL_DB_GetFinalComms (long NotCod,unsigned NumFinalCommsToGet, MYSQL_RES **mysql_res);
MYSQL_RES **mysql_res); unsigned Tml_DB_GetDataOfCommByCod (long PubCod,MYSQL_RES **mysql_res);
unsigned TL_DB_GetDataOfCommByCod (long PubCod,MYSQL_RES **mysql_res); void Tml_DB_InsertCommContent (long PubCod,
void TL_DB_InsertCommContent (long PubCod, const struct Tml_Pst_Content *Content);
const struct TL_Pst_Content *Content); long Tml_DB_GetMedCodFromComm (long PubCod);
long TL_DB_GetMedCodFromComm (long PubCod); void Tml_DB_RemoveCommFavs (long PubCod);
void TL_DB_RemoveCommFavs (long PubCod); void Tml_DB_RemoveCommContent (long PubCod);
void TL_DB_RemoveCommContent (long PubCod); void Tml_DB_RemoveCommPub (long PubCod);
void TL_DB_RemoveCommPub (long PubCod); void Tml_DB_RemoveAllCommsInAllNotesOf (long UsrCod);
void TL_DB_RemoveAllCommsInAllNotesOf (long UsrCod); void Tml_DB_RemoveAllCommsMadeBy (long UsrCod);
void TL_DB_RemoveAllCommsMadeBy (long UsrCod);
/****************************** Publications *********************************/ /****************************** Publications *********************************/
void TL_DB_CreateSubQueryPublishers (const struct TL_Timeline *Timeline, void Tml_DB_CreateSubQueryPublishers (const struct Tml_Timeline *Timeline,
struct TL_Pub_SubQueries *SubQueries); struct Tml_Pub_SubQueries *SubQueries);
void TL_DB_CreateSubQueryAlreadyExists (const struct TL_Timeline *Timeline, void Tml_DB_CreateSubQueryAlreadyExists (const struct Tml_Timeline *Timeline,
struct TL_Pub_SubQueries *SubQueries); struct Tml_Pub_SubQueries *SubQueries);
void TL_DB_CreateSubQueryRangeBottom (long Bottom,struct TL_Pub_SubQueries *SubQueries); void Tml_DB_CreateSubQueryRangeBottom (long Bottom,struct Tml_Pub_SubQueries *SubQueries);
void TL_DB_CreateSubQueryRangeTop (long Top,struct TL_Pub_SubQueries *SubQueries); void Tml_DB_CreateSubQueryRangeTop (long Top,struct Tml_Pub_SubQueries *SubQueries);
unsigned TL_DB_SelectTheMostRecentPub (const struct TL_Pub_SubQueries *SubQueries, unsigned Tml_DB_SelectTheMostRecentPub (const struct Tml_Pub_SubQueries *SubQueries,
MYSQL_RES **mysql_res); MYSQL_RES **mysql_res);
unsigned TL_DB_GetDataOfPubByCod (long PubCod,MYSQL_RES **mysql_res); unsigned Tml_DB_GetDataOfPubByCod (long PubCod,MYSQL_RES **mysql_res);
long TL_DB_GetNotCodFromPubCod (long PubCod); long Tml_DB_GetNotCodFromPubCod (long PubCod);
long TL_DB_GetPubCodFromSession (const char *FieldName); long Tml_DB_GetPubCodFromSession (const char *FieldName);
unsigned long TL_DB_GetNumPubsUsr (long UsrCod); unsigned long Tml_DB_GetNumPubsUsr (long UsrCod);
long TL_DB_CreateNewPub (const struct TL_Pub_Publication *Pub); long Tml_DB_CreateNewPub (const struct Tml_Pub_Publication *Pub);
void TL_DB_UpdateFirstPubCodInSession (long FirstPubCod); void Tml_DB_UpdateFirstPubCodInSession (long FirstPubCod);
void TL_DB_UpdateLastPubCodInSession (void); void Tml_DB_UpdateLastPubCodInSession (void);
void TL_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod); void Tml_DB_UpdateFirstLastPubCodsInSession (long FirstPubCod);
void TL_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (long UsrCod); void Tml_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (long UsrCod);
void TL_DB_RemoveAllPubsPublishedBy (long UsrCod); void Tml_DB_RemoveAllPubsPublishedBy (long UsrCod);
/****************************** Favourites ***********************************/ /****************************** Favourites ***********************************/
bool TL_DB_CheckIfFavedByUsr (TL_Usr_FavSha_t FavSha,long Cod,long UsrCod); bool Tml_DB_CheckIfFavedByUsr (Tml_Usr_FavSha_t FavSha,long Cod,long UsrCod);
unsigned TL_DB_GetNumFavers (TL_Usr_FavSha_t FavSha,long Cod,long UsrCod); unsigned Tml_DB_GetNumFavers (Tml_Usr_FavSha_t FavSha,long Cod,long UsrCod);
unsigned TL_DB_GetFavers (TL_Usr_FavSha_t FavSha, unsigned Tml_DB_GetFavers (Tml_Usr_FavSha_t FavSha,
long Cod,long UsrCod,unsigned MaxUsrs, long Cod,long UsrCod,unsigned MaxUsrs,
MYSQL_RES **mysql_res); MYSQL_RES **mysql_res);
void TL_DB_MarkAsFav (TL_Usr_FavSha_t FavSha,long Cod); void Tml_DB_MarkAsFav (Tml_Usr_FavSha_t FavSha,long Cod);
void TL_DB_UnmarkAsFav (TL_Usr_FavSha_t FavSha,long Cod); void Tml_DB_UnmarkAsFav (Tml_Usr_FavSha_t FavSha,long Cod);
void TL_DB_RemoveAllFavsMadeByUsr (TL_Usr_FavSha_t FavSha,long UsrCod); void Tml_DB_RemoveAllFavsMadeByUsr (Tml_Usr_FavSha_t FavSha,long UsrCod);
void TL_DB_RemoveAllFavsToPubsBy (TL_Usr_FavSha_t FavSha,long UsrCod); void Tml_DB_RemoveAllFavsToPubsBy (Tml_Usr_FavSha_t FavSha,long UsrCod);
void TL_DB_RemoveAllFavsToAllCommsInAllNotesBy (long UsrCod); void Tml_DB_RemoveAllFavsToAllCommsInAllNotesBy (long UsrCod);
/******************************** Shared *************************************/ /******************************** Shared *************************************/
bool TL_DB_CheckIfSharedByUsr (long NotCod,long UsrCod); bool Tml_DB_CheckIfSharedByUsr (long NotCod,long UsrCod);
unsigned TL_DB_GetNumSharers (long NotCod,long UsrCod); unsigned Tml_DB_GetNumSharers (long NotCod,long UsrCod);
unsigned TL_DB_GetSharers (long NotCod,long UsrCod,unsigned MaxUsrs, unsigned Tml_DB_GetSharers (long NotCod,long UsrCod,unsigned MaxUsrs,
MYSQL_RES **mysql_res); MYSQL_RES **mysql_res);
void TL_DB_RemoveSharedPub (long NotCod); void Tml_DB_RemoveSharedPub (long NotCod);
#endif #endif

View File

@ -55,144 +55,144 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Fav_FavNote (struct TL_Not_Note *Not); static void Tml_Fav_FavNote (struct Tml_Not_Note *Not);
static void TL_Fav_UnfNote (struct TL_Not_Note *Not); static void Tml_Fav_UnfNote (struct Tml_Not_Note *Not);
static void TL_Fav_FavComm (struct TL_Com_Comment *Com); static void Tml_Fav_FavComm (struct Tml_Com_Comment *Com);
static void TL_Fav_UnfComm (struct TL_Com_Comment *Com); static void Tml_Fav_UnfComm (struct Tml_Com_Comment *Com);
/*****************************************************************************/ /*****************************************************************************/
/************************** Show all favers of a note ************************/ /************************** Show all favers of a note ************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Fav_ShowAllFaversNoteUsr (void) void Tml_Fav_ShowAllFaversNoteUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Show all favers *****/ /***** Show all favers *****/
TL_Fav_ShowAllFaversNoteGbl (); Tml_Fav_ShowAllFaversNoteGbl ();
} }
void TL_Fav_ShowAllFaversNoteGbl (void) void Tml_Fav_ShowAllFaversNoteGbl (void)
{ {
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Get data of note *****/ /***** Get data of note *****/
Not.NotCod = TL_Not_GetParamNotCod (); Not.NotCod = Tml_Not_GetParamNotCod ();
TL_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
/***** Write HTML inside DIV with form to fav/unfav *****/ /***** Write HTML inside DIV with form to fav/unfav *****/
TL_Usr_PutIconFavSha (TL_Usr_FAV_UNF_NOTE, Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_NOTE,
Not.NotCod,Not.UsrCod,Not.NumFavs, Not.NotCod,Not.UsrCod,Not.NumFavs,
TL_Usr_SHOW_ALL_USRS); Tml_Usr_SHOW_ALL_USRS);
} }
/*****************************************************************************/ /*****************************************************************************/
/********************** Mark/unmark a note as favourite **********************/ /********************** Mark/unmark a note as favourite **********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Fav_FavNoteUsr (void) void Tml_Fav_FavNoteUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Mark note as favourite *****/ /***** Mark note as favourite *****/
TL_Fav_FavNoteGbl (); Tml_Fav_FavNoteGbl ();
} }
void TL_Fav_FavNoteGbl (void) void Tml_Fav_FavNoteGbl (void)
{ {
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Mark note as favourite *****/ /***** Mark note as favourite *****/
TL_Fav_FavNote (&Not); Tml_Fav_FavNote (&Not);
/***** Write HTML inside DIV with form to unfav *****/ /***** Write HTML inside DIV with form to unfav *****/
TL_Usr_PutIconFavSha (TL_Usr_FAV_UNF_NOTE, Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_NOTE,
Not.NotCod,Not.UsrCod,Not.NumFavs, Not.NotCod,Not.UsrCod,Not.NumFavs,
TL_Usr_SHOW_FEW_USRS); Tml_Usr_SHOW_FEW_USRS);
} }
void TL_Fav_UnfNoteUsr (void) void Tml_Fav_UnfNoteUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Unfav a note previously marked as favourite *****/ /***** Unfav a note previously marked as favourite *****/
TL_Fav_UnfNoteGbl (); Tml_Fav_UnfNoteGbl ();
} }
void TL_Fav_UnfNoteGbl (void) void Tml_Fav_UnfNoteGbl (void)
{ {
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Stop marking as favourite a previously favourited note *****/ /***** Stop marking as favourite a previously favourited note *****/
TL_Fav_UnfNote (&Not); Tml_Fav_UnfNote (&Not);
/***** Write HTML inside DIV with form to fav *****/ /***** Write HTML inside DIV with form to fav *****/
TL_Usr_PutIconFavSha (TL_Usr_FAV_UNF_NOTE, Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_NOTE,
Not.NotCod,Not.UsrCod,Not.NumFavs, Not.NotCod,Not.UsrCod,Not.NumFavs,
TL_Usr_SHOW_FEW_USRS); Tml_Usr_SHOW_FEW_USRS);
} }
static void TL_Fav_FavNote (struct TL_Not_Note *Not) static void Tml_Fav_FavNote (struct Tml_Not_Note *Not)
{ {
long OriginalPubCod; long OriginalPubCod;
/***** Get data of note *****/ /***** Get data of note *****/
Not->NotCod = TL_Not_GetParamNotCod (); Not->NotCod = Tml_Not_GetParamNotCod ();
TL_Not_GetDataOfNoteByCod (Not); Tml_Not_GetDataOfNoteByCod (Not);
/***** Do some checks *****/ /***** Do some checks *****/
if (!TL_Usr_CheckIfICanFavSha (Not->NotCod,Not->UsrCod)) if (!Tml_Usr_CheckIfICanFavSha (Not->NotCod,Not->UsrCod))
return; return;
/***** Trivial check: Have I faved this note? *****/ /***** Trivial check: Have I faved this note? *****/
if (TL_Usr_CheckIfFavedSharedByUsr (TL_Usr_FAV_UNF_NOTE,Not->NotCod, if (Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FAV_UNF_NOTE,Not->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) Gbl.Usrs.Me.UsrDat.UsrCod))
return; return;
/***** Mark note as favourite in database *****/ /***** Mark note as favourite in database *****/
TL_DB_MarkAsFav (TL_Usr_FAV_UNF_NOTE,Not->NotCod); Tml_DB_MarkAsFav (Tml_Usr_FAV_UNF_NOTE,Not->NotCod);
/***** Update number of times this note is favourited *****/ /***** Update number of times this note is favourited *****/
Not->NumFavs = TL_DB_GetNumFavers (TL_Usr_FAV_UNF_NOTE, Not->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_NOTE,
Not->NotCod,Not->UsrCod); Not->NotCod,Not->UsrCod);
/***** Create notification about favourite post /***** Create notification about favourite post
for the author of the post *****/ for the author of the post *****/
OriginalPubCod = TL_DB_GetPubCodOfOriginalNote (Not->NotCod); OriginalPubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod);
if (OriginalPubCod > 0) if (OriginalPubCod > 0)
TL_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod,Ntf_EVENT_TL_FAV); Tml_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod,Ntf_EVENT_TL_FAV);
} }
static void TL_Fav_UnfNote (struct TL_Not_Note *Not) static void Tml_Fav_UnfNote (struct Tml_Not_Note *Not)
{ {
long OriginalPubCod; long OriginalPubCod;
/***** Get data of note *****/ /***** Get data of note *****/
Not->NotCod = TL_Not_GetParamNotCod (); Not->NotCod = Tml_Not_GetParamNotCod ();
TL_Not_GetDataOfNoteByCod (Not); Tml_Not_GetDataOfNoteByCod (Not);
/***** Do some checks *****/ /***** Do some checks *****/
if (!TL_Usr_CheckIfICanFavSha (Not->NotCod,Not->UsrCod)) if (!Tml_Usr_CheckIfICanFavSha (Not->NotCod,Not->UsrCod))
return; return;
/***** Trivial check: Have I faved this note? *****/ /***** Trivial check: Have I faved this note? *****/
if (!TL_Usr_CheckIfFavedSharedByUsr (TL_Usr_FAV_UNF_NOTE,Not->NotCod, if (!Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FAV_UNF_NOTE,Not->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) Gbl.Usrs.Me.UsrDat.UsrCod))
return; return;
/***** Delete the mark as favourite from database *****/ /***** Delete the mark as favourite from database *****/
TL_DB_UnmarkAsFav (TL_Usr_FAV_UNF_NOTE,Not->NotCod); Tml_DB_UnmarkAsFav (Tml_Usr_FAV_UNF_NOTE,Not->NotCod);
/***** Update number of times this note is favourited *****/ /***** Update number of times this note is favourited *****/
Not->NumFavs = TL_DB_GetNumFavers (TL_Usr_FAV_UNF_NOTE, Not->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_NOTE,
Not->NotCod,Not->UsrCod); Not->NotCod,Not->UsrCod);
/***** Mark possible notifications on this note as removed *****/ /***** Mark possible notifications on this note as removed *****/
OriginalPubCod = TL_DB_GetPubCodOfOriginalNote (Not->NotCod); OriginalPubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod);
if (OriginalPubCod > 0) if (OriginalPubCod > 0)
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_FAV,OriginalPubCod); Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_FAV,OriginalPubCod);
} }
@ -201,97 +201,97 @@ static void TL_Fav_UnfNote (struct TL_Not_Note *Not)
/************************** Show all favers of a note ************************/ /************************** Show all favers of a note ************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Fav_ShowAllFaversComUsr (void) void Tml_Fav_ShowAllFaversComUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Show all favers *****/ /***** Show all favers *****/
TL_Fav_ShowAllFaversComGbl (); Tml_Fav_ShowAllFaversComGbl ();
} }
void TL_Fav_ShowAllFaversComGbl (void) void Tml_Fav_ShowAllFaversComGbl (void)
{ {
struct TL_Com_Comment Com; struct Tml_Com_Comment Com;
/***** Get data of comment *****/ /***** Get data of comment *****/
Med_MediaConstructor (&Com.Content.Media); Med_MediaConstructor (&Com.Content.Media);
Com.PubCod = TL_Pub_GetParamPubCod (); Com.PubCod = Tml_Pub_GetParamPubCod ();
TL_Com_GetDataOfCommByCod (&Com); Tml_Com_GetDataOfCommByCod (&Com);
Med_MediaDestructor (&Com.Content.Media); Med_MediaDestructor (&Com.Content.Media);
/***** Write HTML inside DIV with form to fav/unfav *****/ /***** Write HTML inside DIV with form to fav/unfav *****/
TL_Usr_PutIconFavSha (TL_Usr_FAV_UNF_COMM, Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_COMM,
Com.PubCod,Com.UsrCod,Com.NumFavs, Com.PubCod,Com.UsrCod,Com.NumFavs,
TL_Usr_SHOW_ALL_USRS); Tml_Usr_SHOW_ALL_USRS);
} }
/*****************************************************************************/ /*****************************************************************************/
/********************* Mark/unmark a comment as favourite ********************/ /********************* Mark/unmark a comment as favourite ********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Fav_FavCommUsr (void) void Tml_Fav_FavCommUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Mark comment as favourite *****/ /***** Mark comment as favourite *****/
TL_Fav_FavCommGbl (); Tml_Fav_FavCommGbl ();
} }
void TL_Fav_FavCommGbl (void) void Tml_Fav_FavCommGbl (void)
{ {
struct TL_Com_Comment Com; struct Tml_Com_Comment Com;
/***** Mark comment as favourite *****/ /***** Mark comment as favourite *****/
TL_Fav_FavComm (&Com); Tml_Fav_FavComm (&Com);
/***** Write HTML inside DIV with form to unfav *****/ /***** Write HTML inside DIV with form to unfav *****/
TL_Usr_PutIconFavSha (TL_Usr_FAV_UNF_COMM, Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_COMM,
Com.PubCod,Com.UsrCod,Com.NumFavs, Com.PubCod,Com.UsrCod,Com.NumFavs,
TL_Usr_SHOW_FEW_USRS); Tml_Usr_SHOW_FEW_USRS);
} }
void TL_Fav_UnfCommUsr (void) void Tml_Fav_UnfCommUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Unfav a comment previously marked as favourite *****/ /***** Unfav a comment previously marked as favourite *****/
TL_Fav_UnfCommGbl (); Tml_Fav_UnfCommGbl ();
} }
void TL_Fav_UnfCommGbl (void) void Tml_Fav_UnfCommGbl (void)
{ {
struct TL_Com_Comment Com; struct Tml_Com_Comment Com;
/***** Stop marking as favourite a previously favourited comment *****/ /***** Stop marking as favourite a previously favourited comment *****/
TL_Fav_UnfComm (&Com); Tml_Fav_UnfComm (&Com);
/***** Write HTML inside DIV with form to fav *****/ /***** Write HTML inside DIV with form to fav *****/
TL_Usr_PutIconFavSha (TL_Usr_FAV_UNF_COMM, Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_COMM,
Com.PubCod,Com.UsrCod,Com.NumFavs, Com.PubCod,Com.UsrCod,Com.NumFavs,
TL_Usr_SHOW_FEW_USRS); Tml_Usr_SHOW_FEW_USRS);
} }
static void TL_Fav_FavComm (struct TL_Com_Comment *Com) static void Tml_Fav_FavComm (struct Tml_Com_Comment *Com)
{ {
/***** Initialize image *****/ /***** Initialize image *****/
Med_MediaConstructor (&Com->Content.Media); Med_MediaConstructor (&Com->Content.Media);
/***** Get data of comment *****/ /***** Get data of comment *****/
Com->PubCod = TL_Pub_GetParamPubCod (); Com->PubCod = Tml_Pub_GetParamPubCod ();
TL_Com_GetDataOfCommByCod (Com); Tml_Com_GetDataOfCommByCod (Com);
/***** Do some checks *****/ /***** Do some checks *****/
if (!TL_Usr_CheckIfICanFavSha (Com->PubCod,Com->UsrCod)) if (!Tml_Usr_CheckIfICanFavSha (Com->PubCod,Com->UsrCod))
{ {
Med_MediaDestructor (&Com->Content.Media); Med_MediaDestructor (&Com->Content.Media);
return; return;
} }
/***** Trivial check: Have I faved this comment? *****/ /***** Trivial check: Have I faved this comment? *****/
if (TL_Usr_CheckIfFavedSharedByUsr (TL_Usr_FAV_UNF_COMM,Com->PubCod, if (Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FAV_UNF_COMM,Com->PubCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) Gbl.Usrs.Me.UsrDat.UsrCod))
{ {
Med_MediaDestructor (&Com->Content.Media); Med_MediaDestructor (&Com->Content.Media);
@ -299,38 +299,38 @@ static void TL_Fav_FavComm (struct TL_Com_Comment *Com)
} }
/***** Mark comment as favourite in database *****/ /***** Mark comment as favourite in database *****/
TL_DB_MarkAsFav (TL_Usr_FAV_UNF_COMM,Com->PubCod); Tml_DB_MarkAsFav (Tml_Usr_FAV_UNF_COMM,Com->PubCod);
/***** Update number of times this comment is favourited *****/ /***** Update number of times this comment is favourited *****/
Com->NumFavs = TL_DB_GetNumFavers (TL_Usr_FAV_UNF_COMM, Com->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_COMM,
Com->PubCod,Com->UsrCod); Com->PubCod,Com->UsrCod);
/***** Create notification about favourite post /***** Create notification about favourite post
for the author of the post *****/ for the author of the post *****/
TL_Ntf_CreateNotifToAuthor (Com->UsrCod,Com->PubCod,Ntf_EVENT_TL_FAV); Tml_Ntf_CreateNotifToAuthor (Com->UsrCod,Com->PubCod,Ntf_EVENT_TL_FAV);
/***** Free image *****/ /***** Free image *****/
Med_MediaDestructor (&Com->Content.Media); Med_MediaDestructor (&Com->Content.Media);
} }
static void TL_Fav_UnfComm (struct TL_Com_Comment *Com) static void Tml_Fav_UnfComm (struct Tml_Com_Comment *Com)
{ {
/***** Initialize image *****/ /***** Initialize image *****/
Med_MediaConstructor (&Com->Content.Media); Med_MediaConstructor (&Com->Content.Media);
/***** Get data of comment *****/ /***** Get data of comment *****/
Com->PubCod = TL_Pub_GetParamPubCod (); Com->PubCod = Tml_Pub_GetParamPubCod ();
TL_Com_GetDataOfCommByCod (Com); Tml_Com_GetDataOfCommByCod (Com);
/***** Do some checks *****/ /***** Do some checks *****/
if (!TL_Usr_CheckIfICanFavSha (Com->PubCod,Com->UsrCod)) if (!Tml_Usr_CheckIfICanFavSha (Com->PubCod,Com->UsrCod))
{ {
Med_MediaDestructor (&Com->Content.Media); Med_MediaDestructor (&Com->Content.Media);
return; return;
} }
/***** Trivial check: Have I faved this comment? *****/ /***** Trivial check: Have I faved this comment? *****/
if (!TL_Usr_CheckIfFavedSharedByUsr (TL_Usr_FAV_UNF_COMM,Com->PubCod, if (!Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FAV_UNF_COMM,Com->PubCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) Gbl.Usrs.Me.UsrDat.UsrCod))
{ {
Med_MediaDestructor (&Com->Content.Media); Med_MediaDestructor (&Com->Content.Media);
@ -338,10 +338,10 @@ static void TL_Fav_UnfComm (struct TL_Com_Comment *Com)
} }
/***** Delete the mark as favourite from database *****/ /***** Delete the mark as favourite from database *****/
TL_DB_UnmarkAsFav (TL_Usr_FAV_UNF_COMM,Com->PubCod); Tml_DB_UnmarkAsFav (Tml_Usr_FAV_UNF_COMM,Com->PubCod);
/***** Update number of times this comment is favourited *****/ /***** Update number of times this comment is favourited *****/
Com->NumFavs = TL_DB_GetNumFavers (TL_Usr_FAV_UNF_COMM, Com->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_COMM,
Com->PubCod,Com->UsrCod); Com->PubCod,Com->UsrCod);
/***** Mark possible notifications on this comment as removed *****/ /***** Mark possible notifications on this comment as removed *****/

View File

@ -1,7 +1,7 @@
// swad_timeline_favourite.h: social timeline favourites // swad_timeline_favourite.h: social timeline favourites
#ifndef _SWAD_TL_FAV #ifndef _SWAD_TML_FAV
#define _SWAD_TL_FAV #define _SWAD_TML_FAV
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -31,25 +31,25 @@
/************************ Public constants and types *************************/ /************************ Public constants and types *************************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_Fav_ICON_FAV "heart.svg" #define Tml_Fav_ICON_FAV "heart.svg"
#define TL_Fav_ICON_FAVED "heart-red.svg" #define Tml_Fav_ICON_FAVED "heart-red.svg"
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Fav_ShowAllFaversNoteUsr (void); void Tml_Fav_ShowAllFaversNoteUsr (void);
void TL_Fav_ShowAllFaversNoteGbl (void); void Tml_Fav_ShowAllFaversNoteGbl (void);
void TL_Fav_FavNoteUsr (void); void Tml_Fav_FavNoteUsr (void);
void TL_Fav_FavNoteGbl (void); void Tml_Fav_FavNoteGbl (void);
void TL_Fav_UnfNoteUsr (void); void Tml_Fav_UnfNoteUsr (void);
void TL_Fav_UnfNoteGbl (void); void Tml_Fav_UnfNoteGbl (void);
void TL_Fav_ShowAllFaversComUsr (void); void Tml_Fav_ShowAllFaversComUsr (void);
void TL_Fav_ShowAllFaversComGbl (void); void Tml_Fav_ShowAllFaversComGbl (void);
void TL_Fav_FavCommUsr (void); void Tml_Fav_FavCommUsr (void);
void TL_Fav_FavCommGbl (void); void Tml_Fav_FavCommGbl (void);
void TL_Fav_UnfCommUsr (void); void Tml_Fav_UnfCommUsr (void);
void TL_Fav_UnfCommGbl (void); void Tml_Fav_UnfCommGbl (void);
#endif #endif

View File

@ -44,45 +44,45 @@
/************************* Private constants and types ***********************/ /************************* Private constants and types ***********************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_Frm_ICON_ELLIPSIS "ellipsis-h.svg" #define Tml_Frm_ICON_ELLIPSIS "ellipsis-h.svg"
const Act_Action_t TL_Frm_ActionGbl[TL_Frm_NUM_ACTIONS] = const Act_Action_t Tml_Frm_ActionGbl[Tml_Frm_NUM_ACTIONS] =
{ {
[TL_Frm_RECEIVE_POST] = ActRcvPstGblTL, [Tml_Frm_RECEIVE_POST] = ActRcvPstGblTL,
[TL_Frm_RECEIVE_COMM] = ActRcvComGblTL, [Tml_Frm_RECEIVE_COMM] = ActRcvComGblTL,
[TL_Frm_REQ_REM_NOTE] = ActReqRemPubGblTL, [Tml_Frm_REQ_REM_NOTE] = ActReqRemPubGblTL,
[TL_Frm_REQ_REM_COMM] = ActReqRemComGblTL, [Tml_Frm_REQ_REM_COMM] = ActReqRemComGblTL,
[TL_Frm_REM_NOTE ] = ActRemPubGblTL, [Tml_Frm_REM_NOTE ] = ActRemPubGblTL,
[TL_Frm_REM_COMM ] = ActRemComGblTL, [Tml_Frm_REM_COMM ] = ActRemComGblTL,
[TL_Frm_SHA_NOTE ] = ActShaNotGblTL, [Tml_Frm_SHA_NOTE ] = ActShaNotGblTL,
[TL_Frm_UNS_NOTE ] = ActUnsNotGblTL, [Tml_Frm_UNS_NOTE ] = ActUnsNotGblTL,
[TL_Frm_FAV_NOTE ] = ActFavNotGblTL, [Tml_Frm_FAV_NOTE ] = ActFavNotGblTL,
[TL_Frm_FAV_COMM ] = ActFavComGblTL, [Tml_Frm_FAV_COMM ] = ActFavComGblTL,
[TL_Frm_UNF_NOTE ] = ActUnfNotGblTL, [Tml_Frm_UNF_NOTE ] = ActUnfNotGblTL,
[TL_Frm_UNF_COMM ] = ActUnfComGblTL, [Tml_Frm_UNF_COMM ] = ActUnfComGblTL,
[TL_Frm_ALL_SHA_NOTE] = ActAllShaNotGblTL, [Tml_Frm_ALL_SHA_NOTE] = ActAllShaNotGblTL,
[TL_Frm_ALL_FAV_NOTE] = ActAllFavNotGblTL, [Tml_Frm_ALL_FAV_NOTE] = ActAllFavNotGblTL,
[TL_Frm_ALL_FAV_COMM] = ActAllFavComGblTL, [Tml_Frm_ALL_FAV_COMM] = ActAllFavComGblTL,
[TL_Frm_SHO_HID_COMM] = ActShoHidComGblTL, [Tml_Frm_SHO_HID_COMM] = ActShoHidComGblTL,
}; };
const Act_Action_t TL_Frm_ActionUsr[TL_Frm_NUM_ACTIONS] = const Act_Action_t Tml_Frm_ActionUsr[Tml_Frm_NUM_ACTIONS] =
{ {
[TL_Frm_RECEIVE_POST] = ActRcvPstUsrTL, [Tml_Frm_RECEIVE_POST] = ActRcvPstUsrTL,
[TL_Frm_RECEIVE_COMM] = ActRcvComUsrTL, [Tml_Frm_RECEIVE_COMM] = ActRcvComUsrTL,
[TL_Frm_REQ_REM_NOTE] = ActReqRemPubUsrTL, [Tml_Frm_REQ_REM_NOTE] = ActReqRemPubUsrTL,
[TL_Frm_REQ_REM_COMM] = ActReqRemComUsrTL, [Tml_Frm_REQ_REM_COMM] = ActReqRemComUsrTL,
[TL_Frm_REM_NOTE ] = ActRemPubUsrTL, [Tml_Frm_REM_NOTE ] = ActRemPubUsrTL,
[TL_Frm_REM_COMM ] = ActRemComUsrTL, [Tml_Frm_REM_COMM ] = ActRemComUsrTL,
[TL_Frm_SHA_NOTE ] = ActShaNotUsrTL, [Tml_Frm_SHA_NOTE ] = ActShaNotUsrTL,
[TL_Frm_UNS_NOTE ] = ActUnsNotUsrTL, [Tml_Frm_UNS_NOTE ] = ActUnsNotUsrTL,
[TL_Frm_FAV_NOTE ] = ActFavNotUsrTL, [Tml_Frm_FAV_NOTE ] = ActFavNotUsrTL,
[TL_Frm_FAV_COMM ] = ActFavComUsrTL, [Tml_Frm_FAV_COMM ] = ActFavComUsrTL,
[TL_Frm_UNF_NOTE ] = ActUnfNotUsrTL, [Tml_Frm_UNF_NOTE ] = ActUnfNotUsrTL,
[TL_Frm_UNF_COMM ] = ActUnfComUsrTL, [Tml_Frm_UNF_COMM ] = ActUnfComUsrTL,
[TL_Frm_ALL_SHA_NOTE] = ActAllShaNotUsrTL, [Tml_Frm_ALL_SHA_NOTE] = ActAllShaNotUsrTL,
[TL_Frm_ALL_FAV_NOTE] = ActAllFavNotUsrTL, [Tml_Frm_ALL_FAV_NOTE] = ActAllFavNotUsrTL,
[TL_Frm_ALL_FAV_COMM] = ActAllFavComUsrTL, [Tml_Frm_ALL_FAV_COMM] = ActAllFavComUsrTL,
[TL_Frm_SHO_HID_COMM] = ActShoHidComUsrTL, [Tml_Frm_SHO_HID_COMM] = ActShoHidComUsrTL,
}; };
/*****************************************************************************/ /*****************************************************************************/
@ -103,68 +103,68 @@ extern struct Globals Gbl;
/******************** Form to fav/unfav or share/unshare *********************/ /******************** Form to fav/unfav or share/unshare *********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Frm_PutFormToFavUnfShaUns (TL_Usr_FavSha_t FavSha,long Cod) void Tml_Frm_PutFormToFavUnfShaUns (Tml_Usr_FavSha_t FavSha,long Cod)
{ {
extern const char *Txt_TIMELINE_Mark_as_favourite; extern const char *Txt_TIMELINE_Mark_as_favourite;
extern const char *Txt_TIMELINE_Favourite; extern const char *Txt_TIMELINE_Favourite;
extern const char *Txt_TIMELINE_Share; extern const char *Txt_TIMELINE_Share;
extern const char *Txt_TIMELINE_Shared; extern const char *Txt_TIMELINE_Shared;
struct TL_Form Form[TL_Usr_NUM_FAV_SHA][2] = struct TL_Form Form[Tml_Usr_NUM_FAV_SHA][2] =
{ {
[TL_Usr_FAV_UNF_NOTE] = [Tml_Usr_FAV_UNF_NOTE] =
{ {
[false] = // I have not faved ==> fav [false] = // I have not faved ==> fav
{ {
.Action = TL_Frm_FAV_NOTE, .Action = Tml_Frm_FAV_NOTE,
.ParamFormat = "NotCod=%ld", .ParamFormat = "NotCod=%ld",
.ParamCod = Cod, .ParamCod = Cod,
.Icon = TL_Fav_ICON_FAV, .Icon = Tml_Fav_ICON_FAV,
.Title = Txt_TIMELINE_Mark_as_favourite, .Title = Txt_TIMELINE_Mark_as_favourite,
}, },
[true] = // I have faved ==> unfav [true] = // I have faved ==> unfav
{ {
.Action = TL_Frm_UNF_NOTE, .Action = Tml_Frm_UNF_NOTE,
.ParamFormat = "NotCod=%ld", .ParamFormat = "NotCod=%ld",
.ParamCod = Cod, .ParamCod = Cod,
.Icon = TL_Fav_ICON_FAVED, .Icon = Tml_Fav_ICON_FAVED,
.Title = Txt_TIMELINE_Favourite, .Title = Txt_TIMELINE_Favourite,
}, },
}, },
[TL_Usr_FAV_UNF_COMM] = [Tml_Usr_FAV_UNF_COMM] =
{ {
[false] = // I have not faved ==> fav [false] = // I have not faved ==> fav
{ {
.Action = TL_Frm_FAV_COMM, .Action = Tml_Frm_FAV_COMM,
.ParamFormat = "PubCod=%ld", .ParamFormat = "PubCod=%ld",
.ParamCod = Cod, .ParamCod = Cod,
.Icon = TL_Fav_ICON_FAV, .Icon = Tml_Fav_ICON_FAV,
.Title = Txt_TIMELINE_Mark_as_favourite, .Title = Txt_TIMELINE_Mark_as_favourite,
}, },
[true] = // I have faved ==> unfav [true] = // I have faved ==> unfav
{ {
.Action = TL_Frm_UNF_COMM, .Action = Tml_Frm_UNF_COMM,
.ParamFormat = "PubCod=%ld", .ParamFormat = "PubCod=%ld",
.ParamCod = Cod, .ParamCod = Cod,
.Icon = TL_Fav_ICON_FAVED, .Icon = Tml_Fav_ICON_FAVED,
.Title = Txt_TIMELINE_Favourite, .Title = Txt_TIMELINE_Favourite,
}, },
}, },
[TL_Usr_SHA_UNS_NOTE] = [Tml_Usr_SHA_UNS_NOTE] =
{ {
[false] = // I have not shared ==> share [false] = // I have not shared ==> share
{ {
.Action = TL_Frm_SHA_NOTE, .Action = Tml_Frm_SHA_NOTE,
.ParamFormat = "NotCod=%ld", .ParamFormat = "NotCod=%ld",
.ParamCod = Cod, .ParamCod = Cod,
.Icon = TL_Sha_ICON_SHARE, .Icon = Tml_Sha_ICON_SHARE,
.Title = Txt_TIMELINE_Share, .Title = Txt_TIMELINE_Share,
}, },
[true] = // I have shared ==> unshare [true] = // I have shared ==> unshare
{ {
.Action = TL_Frm_UNS_NOTE, .Action = Tml_Frm_UNS_NOTE,
.ParamFormat = "NotCod=%ld", .ParamFormat = "NotCod=%ld",
.ParamCod = Cod, .ParamCod = Cod,
.Icon = TL_Sha_ICON_SHARED, .Icon = Tml_Sha_ICON_SHARED,
.Title = Txt_TIMELINE_Shared, .Title = Txt_TIMELINE_Shared,
}, },
}, },
@ -172,31 +172,31 @@ void TL_Frm_PutFormToFavUnfShaUns (TL_Usr_FavSha_t FavSha,long Cod)
bool FavedShared; bool FavedShared;
/***** Form and icon to fav/unfav note *****/ /***** Form and icon to fav/unfav note *****/
FavedShared = TL_Usr_CheckIfFavedSharedByUsr (FavSha,Cod,Gbl.Usrs.Me.UsrDat.UsrCod); FavedShared = Tml_Usr_CheckIfFavedSharedByUsr (FavSha,Cod,Gbl.Usrs.Me.UsrDat.UsrCod);
TL_Frm_FormFavSha (&Form[FavSha][FavedShared]); Tml_Frm_FormFavSha (&Form[FavSha][FavedShared]);
} }
/*****************************************************************************/ /*****************************************************************************/
/***************** Begin a form in global or user timeline *******************/ /***************** Begin a form in global or user timeline *******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Frm_BeginForm (const struct TL_Timeline *Timeline,TL_Frm_Action_t Action) void Tml_Frm_BeginForm (const struct Tml_Timeline *Timeline,Tml_Frm_Action_t Action)
{ {
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
{ {
/***** Begin form in user timeline *****/ /***** Begin form in user timeline *****/
Frm_StartFormAnchor (TL_Frm_ActionUsr[Action],"timeline"); Frm_StartFormAnchor (Tml_Frm_ActionUsr[Action],"timeline");
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod); Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
} }
else else
{ {
/***** Begin form in global timeline *****/ /***** Begin form in global timeline *****/
Frm_BeginForm (TL_Frm_ActionGbl[Action]); Frm_BeginForm (Tml_Frm_ActionGbl[Action]);
Usr_PutHiddenParamWho (Timeline->Who); Usr_PutHiddenParamWho (Timeline->Who);
} }
} }
void TL_Frm_EndForm (void) void Tml_Frm_EndForm (void)
{ {
Frm_EndForm (); Frm_EndForm ();
} }
@ -205,9 +205,9 @@ void TL_Frm_EndForm (void)
/********************* Form to show all favers/sharers ***********************/ /********************* Form to show all favers/sharers ***********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Frm_PutFormToSeeAllFaversSharers (TL_Frm_Action_t Action, void Tml_Frm_PutFormToSeeAllFaversSharers (Tml_Frm_Action_t Action,
const char *ParamFormat,long ParamCod, const char *ParamFormat,long ParamCod,
TL_Usr_HowManyUsrs_t HowManyUsrs) Tml_Usr_HowManyUsrs_t HowManyUsrs)
{ {
extern const char *Txt_View_all_USERS; extern const char *Txt_View_all_USERS;
struct TL_Form Form = struct TL_Form Form =
@ -215,19 +215,19 @@ void TL_Frm_PutFormToSeeAllFaversSharers (TL_Frm_Action_t Action,
.Action = Action, .Action = Action,
.ParamFormat = ParamFormat, .ParamFormat = ParamFormat,
.ParamCod = ParamCod, .ParamCod = ParamCod,
.Icon = TL_Frm_ICON_ELLIPSIS, .Icon = Tml_Frm_ICON_ELLIPSIS,
.Title = Txt_View_all_USERS, .Title = Txt_View_all_USERS,
}; };
switch (HowManyUsrs) switch (HowManyUsrs)
{ {
case TL_Usr_SHOW_FEW_USRS: case Tml_Usr_SHOW_FEW_USRS:
/***** Form and icon to view all users *****/ /***** Form and icon to view all users *****/
TL_Frm_FormFavSha (&Form); Tml_Frm_FormFavSha (&Form);
break; break;
case TL_Usr_SHOW_ALL_USRS: case Tml_Usr_SHOW_ALL_USRS:
/***** Disabled icon *****/ /***** Disabled icon *****/
Ico_PutIconOff (TL_Frm_ICON_ELLIPSIS,Txt_View_all_USERS); Ico_PutIconOff (Tml_Frm_ICON_ELLIPSIS,Txt_View_all_USERS);
break; break;
} }
} }
@ -236,7 +236,7 @@ void TL_Frm_PutFormToSeeAllFaversSharers (TL_Frm_Action_t Action,
/******* Form to fav/unfav or share/unshare in global or user timeline *******/ /******* Form to fav/unfav or share/unshare in global or user timeline *******/
/*****************************************************************************/ /*****************************************************************************/
void TL_Frm_FormFavSha (const struct TL_Form *Form) void Tml_Frm_FormFavSha (const struct TL_Form *Form)
{ {
char *OnSubmit; char *OnSubmit;
char ParamStr[7 + Cns_MAX_DECIMAL_DIGITS_LONG + 1]; char ParamStr[7 + Cns_MAX_DECIMAL_DIGITS_LONG + 1];
@ -266,7 +266,7 @@ void TL_Frm_FormFavSha (const struct TL_Form *Form)
if (asprintf (&OnSubmit,"updateDivFaversSharers(this," if (asprintf (&OnSubmit,"updateDivFaversSharers(this,"
"'act=%ld&ses=%s&%s&OtherUsrCod=%s');" "'act=%ld&ses=%s&%s&OtherUsrCod=%s');"
" return false;", // return false is necessary to not submit form " return false;", // return false is necessary to not submit form
Act_GetActCod (TL_Frm_ActionUsr[Form->Action]), Act_GetActCod (Tml_Frm_ActionUsr[Form->Action]),
Gbl.Session.Id, Gbl.Session.Id,
ParamStr, ParamStr,
Gbl.Usrs.Other.UsrDat.EnUsrCod) < 0) Gbl.Usrs.Other.UsrDat.EnUsrCod) < 0)
@ -278,7 +278,7 @@ void TL_Frm_FormFavSha (const struct TL_Form *Form)
if (asprintf (&OnSubmit,"updateDivFaversSharers(this," if (asprintf (&OnSubmit,"updateDivFaversSharers(this,"
"'act=%ld&ses=%s&%s');" "'act=%ld&ses=%s&%s');"
" return false;", // return false is necessary to not submit form " return false;", // return false is necessary to not submit form
Act_GetActCod (TL_Frm_ActionGbl[Form->Action]), Act_GetActCod (Tml_Frm_ActionGbl[Form->Action]),
Gbl.Session.Id, Gbl.Session.Id,
ParamStr) < 0) ParamStr) < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
@ -295,7 +295,7 @@ void TL_Frm_FormFavSha (const struct TL_Form *Form)
/********** Form to show hidden coments in global or user timeline ***********/ /********** Form to show hidden coments in global or user timeline ***********/
/*****************************************************************************/ /*****************************************************************************/
void TL_Frm_FormToShowHiddenComms (long NotCod, void Tml_Frm_FormToShowHiddenComms (long NotCod,
char IdComms[Frm_MAX_BYTES_ID + 1], char IdComms[Frm_MAX_BYTES_ID + 1],
unsigned NumInitialComms) unsigned NumInitialComms)
{ {
@ -319,7 +319,7 @@ void TL_Frm_FormToShowHiddenComms (long NotCod,
"'act=%ld&ses=%s&NotCod=%ld&IdComments=%s&NumHidCom=%u&OtherUsrCod=%s');" "'act=%ld&ses=%s&NotCod=%ld&IdComments=%s&NumHidCom=%u&OtherUsrCod=%s');"
" return false;", // return false is necessary to not submit form " return false;", // return false is necessary to not submit form
IdComms, IdComms,
Act_GetActCod (TL_Frm_ActionUsr[TL_Frm_SHO_HID_COMM]), Act_GetActCod (Tml_Frm_ActionUsr[Tml_Frm_SHO_HID_COMM]),
Gbl.Session.Id, Gbl.Session.Id,
NotCod, NotCod,
IdComms, IdComms,
@ -335,7 +335,7 @@ void TL_Frm_FormToShowHiddenComms (long NotCod,
"'act=%ld&ses=%s&NotCod=%ld&IdComments=%s&NumHidCom=%u');" "'act=%ld&ses=%s&NotCod=%ld&IdComments=%s&NumHidCom=%u');"
" return false;", // return false is necessary to not submit form " return false;", // return false is necessary to not submit form
IdComms, IdComms,
Act_GetActCod (TL_Frm_ActionGbl[TL_Frm_SHO_HID_COMM]), Act_GetActCod (Tml_Frm_ActionGbl[Tml_Frm_SHO_HID_COMM]),
Gbl.Session.Id, Gbl.Session.Id,
NotCod, NotCod,
IdComms, IdComms,
@ -369,22 +369,22 @@ void TL_Frm_FormToShowHiddenComms (long NotCod,
/********************** Form to remove note / comment ************************/ /********************** Form to remove note / comment ************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Frm_BeginAlertRemove (const char *QuestionTxt) void Tml_Frm_BeginAlertRemove (const char *QuestionTxt)
{ {
Ale_ShowAlertAndButton1 (Ale_QUESTION,QuestionTxt); Ale_ShowAlertAndButton1 (Ale_QUESTION,QuestionTxt);
} }
void TL_Frm_EndAlertRemove (struct TL_Timeline *Timeline,TL_Frm_Action_t Action, void Tml_Frm_EndAlertRemove (struct Tml_Timeline *Timeline,Tml_Frm_Action_t Action,
void (*FuncParams) (void *Args)) void (*FuncParams) (void *Args))
{ {
extern const char *Txt_Remove; extern const char *Txt_Remove;
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
Ale_ShowAlertAndButton2 (TL_Frm_ActionUsr[Action],"timeline",NULL, Ale_ShowAlertAndButton2 (Tml_Frm_ActionUsr[Action],"timeline",NULL,
FuncParams,Timeline, FuncParams,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove); Btn_REMOVE_BUTTON,Txt_Remove);
else else
Ale_ShowAlertAndButton2 (TL_Frm_ActionGbl[Action],NULL,NULL, Ale_ShowAlertAndButton2 (Tml_Frm_ActionGbl[Action],NULL,NULL,
FuncParams,Timeline, FuncParams,Timeline,
Btn_REMOVE_BUTTON,Txt_Remove); Btn_REMOVE_BUTTON,Txt_Remove);
} }

View File

@ -1,7 +1,7 @@
// swad_timeline_form.h: social timeline forms // swad_timeline_form.h: social timeline forms
#ifndef _SWAD_TL_FRM #ifndef _SWAD_TML_FRM
#define _SWAD_TL_FRM #define _SWAD_TML_FRM
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -35,38 +35,38 @@
/******************************** Public types *******************************/ /******************************** Public types *******************************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_Frm_NUM_ACTIONS 16 #define Tml_Frm_NUM_ACTIONS 16
typedef enum typedef enum
{ {
TL_Frm_RECEIVE_POST, // Receive post Tml_Frm_RECEIVE_POST, // Receive post
TL_Frm_RECEIVE_COMM, // Receive comment Tml_Frm_RECEIVE_COMM, // Receive comment
TL_Frm_REQ_REM_NOTE, // Request removal note Tml_Frm_REQ_REM_NOTE, // Request removal note
TL_Frm_REQ_REM_COMM, // Request removal comment Tml_Frm_REQ_REM_COMM, // Request removal comment
TL_Frm_REM_NOTE, // Remove note Tml_Frm_REM_NOTE, // Remove note
TL_Frm_REM_COMM, // Remove comment Tml_Frm_REM_COMM, // Remove comment
TL_Frm_SHA_NOTE, // Share a note Tml_Frm_SHA_NOTE, // Share a note
TL_Frm_UNS_NOTE, // Unshare a note Tml_Frm_UNS_NOTE, // Unshare a note
TL_Frm_FAV_NOTE, // Favourite a note Tml_Frm_FAV_NOTE, // Favourite a note
TL_Frm_FAV_COMM, // Favourite a comment Tml_Frm_FAV_COMM, // Favourite a comment
TL_Frm_UNF_NOTE, // Unfavourite a note Tml_Frm_UNF_NOTE, // Unfavourite a note
TL_Frm_UNF_COMM, // Unfavourite a comment Tml_Frm_UNF_COMM, // Unfavourite a comment
TL_Frm_ALL_SHA_NOTE, // Show all sharers of note Tml_Frm_ALL_SHA_NOTE, // Show all sharers of note
TL_Frm_ALL_FAV_NOTE, // Show all favouriters of note Tml_Frm_ALL_FAV_NOTE, // Show all favouriters of note
TL_Frm_ALL_FAV_COMM, // Show all favouriters of comment Tml_Frm_ALL_FAV_COMM, // Show all favouriters of comment
TL_Frm_SHO_HID_COMM, // Show / hide comments Tml_Frm_SHO_HID_COMM, // Show / hide comments
} TL_Frm_Action_t; } Tml_Frm_Action_t;
struct TL_Form struct TL_Form
{ {
TL_Frm_Action_t Action; Tml_Frm_Action_t Action;
const char *ParamFormat; const char *ParamFormat;
long ParamCod; long ParamCod;
const char *Icon; const char *Icon;
@ -77,22 +77,22 @@ struct TL_Form
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Frm_PutFormToFavUnfShaUns (TL_Usr_FavSha_t FavSha,long Cod); void Tml_Frm_PutFormToFavUnfShaUns (Tml_Usr_FavSha_t FavSha,long Cod);
void TL_Frm_BeginForm (const struct TL_Timeline *Timeline,TL_Frm_Action_t Action); void Tml_Frm_BeginForm (const struct Tml_Timeline *Timeline,Tml_Frm_Action_t Action);
void TL_Frm_EndForm (void); void Tml_Frm_EndForm (void);
void TL_Frm_PutFormToSeeAllFaversSharers (TL_Frm_Action_t Action, void Tml_Frm_PutFormToSeeAllFaversSharers (Tml_Frm_Action_t Action,
const char *ParamFormat,long ParamCod, const char *ParamFormat,long ParamCod,
TL_Usr_HowManyUsrs_t HowManyUsrs); Tml_Usr_HowManyUsrs_t HowManyUsrs);
void TL_Frm_FormFavSha (const struct TL_Form *Form); void Tml_Frm_FormFavSha (const struct TL_Form *Form);
void TL_Frm_FormToShowHiddenComms (long NotCod, void Tml_Frm_FormToShowHiddenComms (long NotCod,
char IdComms[Frm_MAX_BYTES_ID + 1], char IdComms[Frm_MAX_BYTES_ID + 1],
unsigned NumInitialComms); unsigned NumInitialComms);
void TL_Frm_BeginAlertRemove (const char *QuestionTxt); void Tml_Frm_BeginAlertRemove (const char *QuestionTxt);
void TL_Frm_EndAlertRemove (struct TL_Timeline *Timeline,TL_Frm_Action_t Action, void Tml_Frm_EndAlertRemove (struct Tml_Timeline *Timeline,Tml_Frm_Action_t Action,
void (*FuncParams) (void *Args)); void (*FuncParams) (void *Args));
#endif #endif

View File

@ -66,69 +66,69 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod); static void Tml_Not_WriteTopMessage (Tml_TopMessage_t TopMessage,long PublisherCod);
static void TL_Not_WriteNote (const struct TL_Timeline *Timeline, static void Tml_Not_WriteNote (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not); const struct Tml_Not_Note *Not);
static void TL_Not_WriteAuthorTimeAndContent (const struct TL_Not_Note *Not, static void Tml_Not_WriteAuthorTimeAndContent (const struct Tml_Not_Note *Not,
const struct UsrData *UsrDat); const struct UsrData *UsrDat);
static void TL_Not_WriteContent (const struct TL_Not_Note *Not); static void Tml_Not_WriteContent (const struct Tml_Not_Note *Not);
static void TL_Not_GetAndWriteNoPost (const struct TL_Not_Note *Not); static void Tml_Not_GetAndWriteNoPost (const struct Tml_Not_Note *Not);
static void TL_Not_GetLocationInHierarchy (const struct TL_Not_Note *Not, static void Tml_Not_GetLocationInHierarchy (const struct Tml_Not_Note *Not,
struct Hie_Hierarchy *Hie, struct Hie_Hierarchy *Hie,
struct For_Forum *Forum, struct For_Forum *Forum,
char ForumName[For_MAX_BYTES_FORUM_NAME + 1]); char ForumName[For_MAX_BYTES_FORUM_NAME + 1]);
static void TL_Not_WriteLocationInHierarchy (const struct TL_Not_Note *Not, static void Tml_Not_WriteLocationInHierarchy (const struct Tml_Not_Note *Not,
const struct Hie_Hierarchy *Hie, const struct Hie_Hierarchy *Hie,
const char ForumName[For_MAX_BYTES_FORUM_NAME + 1]); const char ForumName[For_MAX_BYTES_FORUM_NAME + 1]);
static void TL_Not_PutFormGoToAction (const struct TL_Not_Note *Not, static void Tml_Not_PutFormGoToAction (const struct Tml_Not_Note *Not,
const struct For_Forums *Forums); const struct For_Forums *Forums);
static void TL_Not_WriteButtonsAndComms (const struct TL_Timeline *Timeline, static void Tml_Not_WriteButtonsAndComms (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct Tml_Not_Note *Not,
const struct UsrData *UsrDat); const struct UsrData *UsrDat);
static void TL_Not_WriteButtonToAddAComm (const struct TL_Not_Note *Not, static void Tml_Not_WriteButtonToAddAComm (const struct Tml_Not_Note *Not,
const char IdNewComm[Frm_MAX_BYTES_ID + 1]); const char IdNewComm[Frm_MAX_BYTES_ID + 1]);
static void TL_Not_WriteFavShaRemAndComms (const struct TL_Timeline *Timeline, static void Tml_Not_WriteFavShaRemAndComms (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct Tml_Not_Note *Not,
const struct UsrData *UsrDat); const struct UsrData *UsrDat);
static void TL_Not_WriteFavShaRem (const struct TL_Timeline *Timeline, static void Tml_Not_WriteFavShaRem (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct Tml_Not_Note *Not,
const struct UsrData *UsrDat); const struct UsrData *UsrDat);
static void TL_Not_PutFormToRemoveNote (const struct TL_Timeline *Timeline, static void Tml_Not_PutFormToRemoveNote (const struct Tml_Timeline *Timeline,
long NotCod); long NotCod);
static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline); static void Tml_Not_RequestRemovalNote (struct Tml_Timeline *Timeline);
static void TL_Not_PutParamsRemoveNote (void *Timeline); static void Tml_Not_PutParamsRemoveNote (void *Timeline);
static void TL_Not_RemoveNote (void); static void Tml_Not_RemoveNote (void);
static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not); static void Tml_Not_RemoveNoteMediaAndDBEntries (struct Tml_Not_Note *Not);
static void TL_Not_GetDataOfNoteFromRow (MYSQL_ROW row,struct TL_Not_Note *Not); static void Tml_Not_GetDataOfNoteFromRow (MYSQL_ROW row,struct Tml_Not_Note *Not);
static TL_Not_NoteType_t TL_Not_GetNoteTypeFromStr (const char *Str); static Tml_Not_NoteType_t Tml_Not_GetNoteTypeFromStr (const char *Str);
static void TL_Not_ResetNote (struct TL_Not_Note *Not); static void Tml_Not_ResetNote (struct Tml_Not_Note *Not);
/*****************************************************************************/ /*****************************************************************************/
/****************** Show highlighted note above timeline *********************/ /****************** Show highlighted note above timeline *********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline, void Tml_Not_ShowHighlightedNote (struct Tml_Timeline *Timeline,
struct TL_Not_Note *Not) struct Tml_Not_Note *Not)
{ {
struct UsrData PublisherDat; struct UsrData PublisherDat;
Ntf_NotifyEvent_t NotifyEvent; Ntf_NotifyEvent_t NotifyEvent;
static const TL_TopMessage_t TopMessages[Ntf_NUM_NOTIFY_EVENTS] = static const Tml_TopMessage_t TopMessages[Ntf_NUM_NOTIFY_EVENTS] =
{ {
[Ntf_EVENT_UNKNOWN ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_UNKNOWN ] = Tml_TOP_MESSAGE_NONE,
/* Start tab */ /* Start tab */
[Ntf_EVENT_TL_COMMENT ] = TL_TOP_MESSAGE_COMMENTED, [Ntf_EVENT_TL_COMMENT ] = Tml_TOP_MESSAGE_COMMENTED,
[Ntf_EVENT_TL_FAV ] = TL_TOP_MESSAGE_FAVED, [Ntf_EVENT_TL_FAV ] = Tml_TOP_MESSAGE_FAVED,
[Ntf_EVENT_TL_SHARE ] = TL_TOP_MESSAGE_SHARED, [Ntf_EVENT_TL_SHARE ] = Tml_TOP_MESSAGE_SHARED,
[Ntf_EVENT_TL_MENTION ] = TL_TOP_MESSAGE_MENTIONED, [Ntf_EVENT_TL_MENTION ] = Tml_TOP_MESSAGE_MENTIONED,
[Ntf_EVENT_FOLLOWER ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_FOLLOWER ] = Tml_TOP_MESSAGE_NONE,
/* System tab */ /* System tab */
/* Country tab */ /* Country tab */
/* Institution tab */ /* Institution tab */
@ -136,24 +136,24 @@ void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline,
/* Degree tab */ /* Degree tab */
/* Course tab */ /* Course tab */
/* Assessment tab */ /* Assessment tab */
[Ntf_EVENT_ASSIGNMENT ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_ASSIGNMENT ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_SURVEY ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_SURVEY ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_EXAM_ANNOUNCEMENT] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_EXAM_ANNOUNCEMENT] = Tml_TOP_MESSAGE_NONE,
/* Files tab */ /* Files tab */
[Ntf_EVENT_DOCUMENT_FILE ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_DOCUMENT_FILE ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_TEACHERS_FILE ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_TEACHERS_FILE ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_SHARED_FILE ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_SHARED_FILE ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_MARKS_FILE ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_MARKS_FILE ] = Tml_TOP_MESSAGE_NONE,
/* Users tab */ /* Users tab */
[Ntf_EVENT_ENROLMENT_STD ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_ENROLMENT_STD ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_ENROLMENT_NET ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_ENROLMENT_NET ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_ENROLMENT_TCH ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_ENROLMENT_TCH ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_ENROLMENT_REQUEST] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_ENROLMENT_REQUEST] = Tml_TOP_MESSAGE_NONE,
/* Messages tab */ /* Messages tab */
[Ntf_EVENT_NOTICE ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_NOTICE ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_FORUM_POST_COURSE] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_FORUM_POST_COURSE] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_FORUM_REPLY ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_FORUM_REPLY ] = Tml_TOP_MESSAGE_NONE,
[Ntf_EVENT_MESSAGE ] = TL_TOP_MESSAGE_NONE, [Ntf_EVENT_MESSAGE ] = Tml_TOP_MESSAGE_NONE,
/* Analytics tab */ /* Analytics tab */
/* Profile tab */ /* Profile tab */
}; };
@ -167,7 +167,7 @@ void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline,
NotifyEvent = Ntf_GetParamNotifyEvent (); NotifyEvent = Ntf_GetParamNotifyEvent ();
/***** Get data of the note *****/ /***** Get data of the note *****/
TL_Not_GetDataOfNoteByCod (Not); Tml_Not_GetDataOfNoteByCod (Not);
/***** Show the note highlighted *****/ /***** Show the note highlighted *****/
/* Begin box */ /* Begin box */
@ -179,7 +179,7 @@ void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline,
HTM_DIV_Begin ("class=\"TL_WIDTH TL_NEW_PUB\""); HTM_DIV_Begin ("class=\"TL_WIDTH TL_NEW_PUB\"");
/* Check and write note with top message */ /* Check and write note with top message */
TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,Not, Tml_Not_CheckAndWriteNoteWithTopMsg (Timeline,Not,
TopMessages[NotifyEvent], TopMessages[NotifyEvent],
PublisherDat.UsrCod); PublisherDat.UsrCod);
@ -194,10 +194,10 @@ void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline,
/****************** Check and write note with top message ********************/ /****************** Check and write note with top message ********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_CheckAndWriteNoteWithTopMsg (const struct TL_Timeline *Timeline, void Tml_Not_CheckAndWriteNoteWithTopMsg (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct Tml_Not_Note *Not,
TL_TopMessage_t TopMessage, Tml_TopMessage_t TopMessage,
long PublisherCod) // Who did the action (publication, commenting, faving, sharing, mentioning) long PublisherCod) // Who did the action (publication, commenting, faving, sharing, mentioning)
{ {
/*__________________________________________ /*__________________________________________
| | \ | | \
@ -234,22 +234,22 @@ void TL_Not_CheckAndWriteNoteWithTopMsg (const struct TL_Timeline *Timeline,
} }
/***** Write sharer/commenter if distinct to author *****/ /***** Write sharer/commenter if distinct to author *****/
if (TopMessage != TL_TOP_MESSAGE_NONE) if (TopMessage != Tml_TOP_MESSAGE_NONE)
TL_Not_WriteTopMessage (TopMessage,PublisherCod); Tml_Not_WriteTopMessage (TopMessage,PublisherCod);
/***** Write note *****/ /***** Write note *****/
TL_Not_WriteNote (Timeline,Not); Tml_Not_WriteNote (Timeline,Not);
} }
/*****************************************************************************/ /*****************************************************************************/
/*************** Write sharer/commenter if distinct to author ****************/ /*************** Write sharer/commenter if distinct to author ****************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod) static void Tml_Not_WriteTopMessage (Tml_TopMessage_t TopMessage,long PublisherCod)
{ {
extern const char *Txt_My_public_profile; extern const char *Txt_My_public_profile;
extern const char *Txt_Another_user_s_profile; extern const char *Txt_Another_user_s_profile;
extern const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[TL_NUM_TOP_MESSAGES]; extern const char *Txt_TIMELINE_NOTE_TOP_MESSAGES[Tml_NUM_TOP_MESSAGES];
struct UsrData PublisherDat; struct UsrData PublisherDat;
/***** Initialize structure with user's data *****/ /***** Initialize structure with user's data *****/
@ -260,7 +260,7 @@ static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherDat,Usr_DONT_GET_PREFS)) // Really we only need EncryptedUsrCod and FullName if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherDat,Usr_DONT_GET_PREFS)) // Really we only need EncryptedUsrCod and FullName
{ {
/***** Begin container *****/ /***** Begin container *****/
HTM_DIV_Begin ("class=\"TL_TOP_CONT TL_TOP_PUBLISHER TL_WIDTH\""); HTM_DIV_Begin ("class=\"Tml_TOP_CONT Tml_TOP_PUBLISHER TL_WIDTH\"");
/***** Show publisher's name inside form to go to user's public profile *****/ /***** Show publisher's name inside form to go to user's public profile *****/
/* Begin form */ /* Begin form */
@ -270,7 +270,7 @@ static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod
/* Publisher's name */ /* Publisher's name */
HTM_BUTTON_SUBMIT_Begin (Usr_ItsMe (PublisherCod) ? Txt_My_public_profile : HTM_BUTTON_SUBMIT_Begin (Usr_ItsMe (PublisherCod) ? Txt_My_public_profile :
Txt_Another_user_s_profile, Txt_Another_user_s_profile,
"BT_LINK TL_TOP_PUBLISHER",NULL); "BT_LINK Tml_TOP_PUBLISHER",NULL);
HTM_Txt (PublisherDat.FullName); HTM_Txt (PublisherDat.FullName);
HTM_BUTTON_End (); HTM_BUTTON_End ();
@ -292,8 +292,8 @@ static void TL_Not_WriteTopMessage (TL_TopMessage_t TopMessage,long PublisherCod
/********************************* Show note *********************************/ /********************************* Show note *********************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteNote (const struct TL_Timeline *Timeline, static void Tml_Not_WriteNote (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not) const struct Tml_Not_Note *Not)
{ {
struct UsrData UsrDat; // Author of the note struct UsrData UsrDat; // Author of the note
@ -303,13 +303,13 @@ static void TL_Not_WriteNote (const struct TL_Timeline *Timeline,
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS);
/***** Left top: author's photo *****/ /***** Left top: author's photo *****/
TL_Not_ShowAuthorPhoto (&UsrDat,true); // Use unique id Tml_Not_ShowAuthorPhoto (&UsrDat,true); // Use unique id
/***** Right top: author's name, time, and content *****/ /***** Right top: author's name, time, and content *****/
TL_Not_WriteAuthorTimeAndContent (Not,&UsrDat); Tml_Not_WriteAuthorTimeAndContent (Not,&UsrDat);
/***** Bottom: buttons and comments *****/ /***** Bottom: buttons and comments *****/
TL_Not_WriteButtonsAndComms (Timeline,Not,&UsrDat); Tml_Not_WriteButtonsAndComms (Timeline,Not,&UsrDat);
/***** Free memory used for author's data *****/ /***** Free memory used for author's data *****/
Usr_UsrDataDestructor (&UsrDat); Usr_UsrDataDestructor (&UsrDat);
@ -319,7 +319,7 @@ static void TL_Not_WriteNote (const struct TL_Timeline *Timeline,
/*********************** Show photo of author of a note **********************/ /*********************** Show photo of author of a note **********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique) void Tml_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique)
{ {
/***** Show author's photo *****/ /***** Show author's photo *****/
/* Begin container */ /* Begin container */
@ -336,20 +336,20 @@ void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique)
/**** Write top right part of a note: author's name, time and note content ***/ /**** Write top right part of a note: author's name, time and note content ***/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteAuthorTimeAndContent (const struct TL_Not_Note *Not, static void Tml_Not_WriteAuthorTimeAndContent (const struct Tml_Not_Note *Not,
const struct UsrData *UsrDat) const struct UsrData *UsrDat)
{ {
/***** Begin top container *****/ /***** Begin top container *****/
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\""); HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
/***** Write author's full name *****/ /***** Write author's full name *****/
TL_Not_WriteAuthorName (UsrDat); Tml_Not_WriteAuthorName (UsrDat);
/***** Write date and time *****/ /***** Write date and time *****/
TL_WriteDateTime (Not->DateTimeUTC); Tml_WriteDateTime (Not->DateTimeUTC);
/***** Write content of the note *****/ /***** Write content of the note *****/
TL_Not_WriteContent (Not); Tml_Not_WriteContent (Not);
/***** End top container *****/ /***** End top container *****/
HTM_DIV_End (); HTM_DIV_End ();
@ -359,7 +359,7 @@ static void TL_Not_WriteAuthorTimeAndContent (const struct TL_Not_Note *Not,
/*************** Write name and nickname of author of a note *****************/ /*************** Write name and nickname of author of a note *****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_WriteAuthorName (const struct UsrData *UsrDat) void Tml_Not_WriteAuthorName (const struct UsrData *UsrDat)
{ {
extern const char *Txt_My_public_profile; extern const char *Txt_My_public_profile;
extern const char *Txt_Another_user_s_profile; extern const char *Txt_Another_user_s_profile;
@ -385,19 +385,19 @@ void TL_Not_WriteAuthorName (const struct UsrData *UsrDat)
/*********************** Get and write a note content ************************/ /*********************** Get and write a note content ************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteContent (const struct TL_Not_Note *Not) static void Tml_Not_WriteContent (const struct Tml_Not_Note *Not)
{ {
if (Not->NoteType == TL_NOTE_POST) // It's a post if (Not->NoteType == TL_NOTE_POST) // It's a post
TL_Pst_GetAndWritePost (Not->Cod); Tml_Pst_GetAndWritePost (Not->Cod);
else // Not a post else // Not a post
TL_Not_GetAndWriteNoPost (Not); Tml_Not_GetAndWriteNoPost (Not);
} }
/*****************************************************************************/ /*****************************************************************************/
/***************** Get and write a note which is not a post ******************/ /***************** Get and write a note which is not a post ******************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_GetAndWriteNoPost (const struct TL_Not_Note *Not) static void Tml_Not_GetAndWriteNoPost (const struct Tml_Not_Note *Not)
{ {
struct Hie_Hierarchy Hie; struct Hie_Hierarchy Hie;
struct For_Forums Forums; struct For_Forums Forums;
@ -409,18 +409,18 @@ static void TL_Not_GetAndWriteNoPost (const struct TL_Not_Note *Not)
/***** Get location in hierarchy *****/ /***** Get location in hierarchy *****/
if (!Not->Unavailable) if (!Not->Unavailable)
TL_Not_GetLocationInHierarchy (Not,&Hie,&Forums.Forum,ForumName); Tml_Not_GetLocationInHierarchy (Not,&Hie,&Forums.Forum,ForumName);
/***** Write note type *****/ /***** Write note type *****/
TL_Not_PutFormGoToAction (Not,&Forums); Tml_Not_PutFormGoToAction (Not,&Forums);
/***** Write location in hierarchy *****/ /***** Write location in hierarchy *****/
if (!Not->Unavailable) if (!Not->Unavailable)
TL_Not_WriteLocationInHierarchy (Not,&Hie,ForumName); Tml_Not_WriteLocationInHierarchy (Not,&Hie,ForumName);
/***** Get and write note summary *****/ /***** Get and write note summary *****/
/* Get note summary */ /* Get note summary */
TL_Not_GetNoteSummary (Not,SummaryStr); Tml_Not_GetNoteSummary (Not,SummaryStr);
/* Write note summary */ /* Write note summary */
HTM_DIV_Begin ("class=\"TL_TXT\""); HTM_DIV_Begin ("class=\"TL_TXT\"");
@ -432,10 +432,10 @@ static void TL_Not_GetAndWriteNoPost (const struct TL_Not_Note *Not)
/************************ Get location in hierarchy **************************/ /************************ Get location in hierarchy **************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_GetLocationInHierarchy (const struct TL_Not_Note *Not, static void Tml_Not_GetLocationInHierarchy (const struct Tml_Not_Note *Not,
struct Hie_Hierarchy *Hie, struct Hie_Hierarchy *Hie,
struct For_Forum *Forum, struct For_Forum *Forum,
char ForumName[For_MAX_BYTES_FORUM_NAME + 1]) char ForumName[For_MAX_BYTES_FORUM_NAME + 1])
{ {
/***** Initialize location in hierarchy *****/ /***** Initialize location in hierarchy *****/
Hie->Cty.CtyCod = Hie->Cty.CtyCod =
@ -489,9 +489,9 @@ static void TL_Not_GetLocationInHierarchy (const struct TL_Not_Note *Not,
/*********************** Write location in hierarchy *************************/ /*********************** Write location in hierarchy *************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteLocationInHierarchy (const struct TL_Not_Note *Not, static void Tml_Not_WriteLocationInHierarchy (const struct Tml_Not_Note *Not,
const struct Hie_Hierarchy *Hie, const struct Hie_Hierarchy *Hie,
const char ForumName[For_MAX_BYTES_FORUM_NAME + 1]) const char ForumName[For_MAX_BYTES_FORUM_NAME + 1])
{ {
extern const char *Txt_Forum; extern const char *Txt_Forum;
extern const char *Txt_Course; extern const char *Txt_Course;
@ -546,8 +546,8 @@ static void TL_Not_WriteLocationInHierarchy (const struct TL_Not_Note *Not,
/************* Put form to go to an action depending on the note *************/ /************* Put form to go to an action depending on the note *************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_PutFormGoToAction (const struct TL_Not_Note *Not, static void Tml_Not_PutFormGoToAction (const struct Tml_Not_Note *Not,
const struct For_Forums *Forums) const struct For_Forums *Forums)
{ {
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM]; extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
extern const char *The_ClassFormInBoxBold[The_NUM_THEMES]; extern const char *The_ClassFormInBoxBold[The_NUM_THEMES];
@ -722,8 +722,8 @@ static void TL_Not_PutFormGoToAction (const struct TL_Not_Note *Not,
/********************** Get note summary and content *************************/ /********************** Get note summary and content *************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_GetNoteSummary (const struct TL_Not_Note *Not, void Tml_Not_GetNoteSummary (const struct Tml_Not_Note *Not,
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]) char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1])
{ {
SummaryStr[0] = '\0'; SummaryStr[0] = '\0';
@ -760,9 +760,9 @@ void TL_Not_GetNoteSummary (const struct TL_Not_Note *Not,
/************************ Write bottom part of a note ************************/ /************************ Write bottom part of a note ************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteButtonsAndComms (const struct TL_Timeline *Timeline, static void Tml_Not_WriteButtonsAndComms (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct Tml_Not_Note *Not,
const struct UsrData *UsrDat) // Author const struct UsrData *UsrDat) // Author
{ {
char IdNewComm[Frm_MAX_BYTES_ID + 1]; char IdNewComm[Frm_MAX_BYTES_ID + 1];
@ -770,30 +770,30 @@ static void TL_Not_WriteButtonsAndComms (const struct TL_Timeline *Timeline,
Frm_SetUniqueId (IdNewComm); Frm_SetUniqueId (IdNewComm);
/***** Left: button to add a comment *****/ /***** Left: button to add a comment *****/
TL_Not_WriteButtonToAddAComm (Not,IdNewComm); Tml_Not_WriteButtonToAddAComm (Not,IdNewComm);
/***** Right: write favs, shared and remove buttons, and comments *****/ /***** Right: write favs, shared and remove buttons, and comments *****/
TL_Not_WriteFavShaRemAndComms (Timeline,Not,UsrDat); Tml_Not_WriteFavShaRemAndComms (Timeline,Not,UsrDat);
/***** Put hidden form to write a new comment *****/ /***** Put hidden form to write a new comment *****/
TL_Com_PutPhotoAndFormToWriteNewComm (Timeline,Not->NotCod,IdNewComm); Tml_Com_PutPhotoAndFormToWriteNewComm (Timeline,Not->NotCod,IdNewComm);
} }
/*****************************************************************************/ /*****************************************************************************/
/********************** Write button to add a comment ************************/ /********************** Write button to add a comment ************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteButtonToAddAComm (const struct TL_Not_Note *Not, static void Tml_Not_WriteButtonToAddAComm (const struct Tml_Not_Note *Not,
const char IdNewComm[Frm_MAX_BYTES_ID + 1]) const char IdNewComm[Frm_MAX_BYTES_ID + 1])
{ {
/***** Begin container *****/ /***** Begin container *****/
HTM_DIV_Begin ("class=\"TL_BOTTOM_LEFT\""); HTM_DIV_Begin ("class=\"TL_BOTTOM_LEFT\"");
/***** Button to add a comment *****/ /***** Button to add a comment *****/
if (Not->Unavailable) // Unavailable notes can not be commented if (Not->Unavailable) // Unavailable notes can not be commented
TL_Com_PutIconCommDisabled (); Tml_Com_PutIconCommDisabled ();
else else
TL_Com_PutIconToToggleComm (IdNewComm); Tml_Com_PutIconToToggleComm (IdNewComm);
/***** End container *****/ /***** End container *****/
HTM_DIV_End (); HTM_DIV_End ();
@ -803,18 +803,18 @@ static void TL_Not_WriteButtonToAddAComm (const struct TL_Not_Note *Not,
/******* Write favs, shared and remove buttons, and comments of a note *******/ /******* Write favs, shared and remove buttons, and comments of a note *******/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteFavShaRemAndComms (const struct TL_Timeline *Timeline, static void Tml_Not_WriteFavShaRemAndComms (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct Tml_Not_Note *Not,
const struct UsrData *UsrDat) // Author const struct UsrData *UsrDat) // Author
{ {
/***** Begin container *****/ /***** Begin container *****/
HTM_DIV_Begin ("class=\"TL_BOTTOM_RIGHT TL_RIGHT_WIDTH\""); HTM_DIV_Begin ("class=\"TL_BOTTOM_RIGHT TL_RIGHT_WIDTH\"");
/***** Write favs, shared and remove buttons int the foot of a note *****/ /***** Write favs, shared and remove buttons int the foot of a note *****/
TL_Not_WriteFavShaRem (Timeline,Not,UsrDat); Tml_Not_WriteFavShaRem (Timeline,Not,UsrDat);
/***** Comments *****/ /***** Comments *****/
TL_Com_WriteCommsInNote (Timeline,Not); Tml_Com_WriteCommsInNote (Timeline,Not);
/***** End container *****/ /***** End container *****/
HTM_DIV_End (); HTM_DIV_End ();
@ -824,9 +824,9 @@ static void TL_Not_WriteFavShaRemAndComms (const struct TL_Timeline *Timeline,
/******* Write favs, shared and remove buttons in the foot of a note *********/ /******* Write favs, shared and remove buttons in the foot of a note *********/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_WriteFavShaRem (const struct TL_Timeline *Timeline, static void Tml_Not_WriteFavShaRem (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct Tml_Not_Note *Not,
const struct UsrData *UsrDat) // Author const struct UsrData *UsrDat) // Author
{ {
static unsigned NumDiv = 0; // Used to create unique div id for fav and shared static unsigned NumDiv = 0; // Used to create unique div id for fav and shared
@ -839,24 +839,24 @@ static void TL_Not_WriteFavShaRem (const struct TL_Timeline *Timeline,
HTM_DIV_Begin ("id=\"fav_not_%s_%u\"" HTM_DIV_Begin ("id=\"fav_not_%s_%u\""
" class=\"TL_FAV_NOT TL_FAV_NOT_WIDTH\"", " class=\"TL_FAV_NOT TL_FAV_NOT_WIDTH\"",
Gbl.UniqueNameEncrypted,NumDiv); Gbl.UniqueNameEncrypted,NumDiv);
TL_Usr_PutIconFavSha (TL_Usr_FAV_UNF_NOTE, Tml_Usr_PutIconFavSha (Tml_Usr_FAV_UNF_NOTE,
Not->NotCod,Not->UsrCod,Not->NumFavs, Not->NotCod,Not->UsrCod,Not->NumFavs,
TL_Usr_SHOW_FEW_USRS); Tml_Usr_SHOW_FEW_USRS);
HTM_DIV_End (); HTM_DIV_End ();
/***** Foot column 2: share zone *****/ /***** Foot column 2: share zone *****/
HTM_DIV_Begin ("id=\"sha_not_%s_%u\"" HTM_DIV_Begin ("id=\"sha_not_%s_%u\""
" class=\"TL_SHA_NOT TL_SHA_NOT_WIDTH\"", " class=\"TL_SHA_NOT TL_SHA_NOT_WIDTH\"",
Gbl.UniqueNameEncrypted,NumDiv); Gbl.UniqueNameEncrypted,NumDiv);
TL_Usr_PutIconFavSha (TL_Usr_SHA_UNS_NOTE, Tml_Usr_PutIconFavSha (Tml_Usr_SHA_UNS_NOTE,
Not->NotCod,Not->UsrCod,Not->NumShared, Not->NotCod,Not->UsrCod,Not->NumShared,
TL_Usr_SHOW_FEW_USRS); Tml_Usr_SHOW_FEW_USRS);
HTM_DIV_End (); HTM_DIV_End ();
/***** Foot column 3: icon to remove this note *****/ /***** Foot column 3: icon to remove this note *****/
HTM_DIV_Begin ("class=\"TL_REM\""); HTM_DIV_Begin ("class=\"TL_REM\"");
if (Usr_ItsMe (UsrDat->UsrCod)) // I am the author if (Usr_ItsMe (UsrDat->UsrCod)) // I am the author
TL_Not_PutFormToRemoveNote (Timeline,Not->NotCod); Tml_Not_PutFormToRemoveNote (Timeline,Not->NotCod);
HTM_DIV_End (); HTM_DIV_End ();
/***** End foot container *****/ /***** End foot container *****/
@ -867,36 +867,36 @@ static void TL_Not_WriteFavShaRem (const struct TL_Timeline *Timeline,
/**************************** Form to remove note ****************************/ /**************************** Form to remove note ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_PutFormToRemoveNote (const struct TL_Timeline *Timeline, static void Tml_Not_PutFormToRemoveNote (const struct Tml_Timeline *Timeline,
long NotCod) long NotCod)
{ {
extern const char *Txt_Remove; extern const char *Txt_Remove;
/***** Form to remove publication *****/ /***** Form to remove publication *****/
/* Begin form */ /* Begin form */
TL_Frm_BeginForm (Timeline,TL_Frm_REQ_REM_NOTE); Tml_Frm_BeginForm (Timeline,Tml_Frm_REQ_REM_NOTE);
TL_Not_PutHiddenParamNotCod (NotCod); Tml_Not_PutHiddenParamNotCod (NotCod);
/* Icon to remove */ /* Icon to remove */
Ico_PutIconLink ("trash.svg",Txt_Remove); Ico_PutIconLink ("trash.svg",Txt_Remove);
/* End form */ /* End form */
TL_Frm_EndForm (); Tml_Frm_EndForm ();
} }
/*****************************************************************************/ /*****************************************************************************/
/***************** Store and publish a note into database ********************/ /***************** Store and publish a note into database ********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_StoreAndPublishNote (TL_Not_NoteType_t NoteType,long Cod) void Tml_Not_StoreAndPublishNote (Tml_Not_NoteType_t NoteType,long Cod)
{ {
struct TL_Pub_Publication Pub; struct Tml_Pub_Publication Pub;
TL_Not_StoreAndPublishNoteInternal (NoteType,Cod,&Pub); Tml_Not_StoreAndPublishNoteInternal (NoteType,Cod,&Pub);
} }
void TL_Not_StoreAndPublishNoteInternal (TL_Not_NoteType_t NoteType,long Cod, void Tml_Not_StoreAndPublishNoteInternal (Tml_Not_NoteType_t NoteType,long Cod,
struct TL_Pub_Publication *Pub) struct Tml_Pub_Publication *Pub)
{ {
long HieCod; // Hierarchy code (institution/centre/degree/course) long HieCod; // Hierarchy code (institution/centre/degree/course)
@ -927,21 +927,21 @@ void TL_Not_StoreAndPublishNoteInternal (TL_Not_NoteType_t NoteType,long Cod,
/***** Publish note in timeline *****/ /***** Publish note in timeline *****/
Pub->PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod; Pub->PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Pub->NotCod = TL_DB_CreateNewNote (NoteType,Cod,Pub->PublisherCod,HieCod); Pub->NotCod = Tml_DB_CreateNewNote (NoteType,Cod,Pub->PublisherCod,HieCod);
Pub->PubType = TL_Pub_ORIGINAL_NOTE; Pub->PubType = Tml_Pub_ORIGINAL_NOTE;
TL_Pub_PublishPubInTimeline (Pub); Tml_Pub_PublishPubInTimeline (Pub);
} }
/*****************************************************************************/ /*****************************************************************************/
/****************** Mark notes of one file as unavailable ********************/ /****************** Mark notes of one file as unavailable ********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_MarkNoteOneFileAsUnavailable (const char *Path) void Tml_Not_MarkNoteOneFileAsUnavailable (const char *Path)
{ {
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER]; extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type]; Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
long FilCod; long FilCod;
TL_Not_NoteType_t NoteType; Tml_Not_NoteType_t NoteType;
switch (FileBrowser) switch (FileBrowser)
{ {
@ -987,7 +987,7 @@ void TL_Not_MarkNoteOneFileAsUnavailable (const char *Path)
default: default:
return; return;
} }
TL_DB_MarkNoteAsUnavailable (NoteType,FilCod); Tml_DB_MarkNoteAsUnavailable (NoteType,FilCod);
} }
break; break;
default: default:
@ -999,11 +999,11 @@ void TL_Not_MarkNoteOneFileAsUnavailable (const char *Path)
/***** Mark possible notes involving children of a folder as unavailable *****/ /***** Mark possible notes involving children of a folder as unavailable *****/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_MarkNotesChildrenOfFolderAsUnavailable (const char *Path) void Tml_Not_MarkNotesChildrenOfFolderAsUnavailable (const char *Path)
{ {
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER]; extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type]; Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
TL_Not_NoteType_t NoteType; Tml_Not_NoteType_t NoteType;
switch (FileBrowser) switch (FileBrowser)
{ {
@ -1045,7 +1045,7 @@ void TL_Not_MarkNotesChildrenOfFolderAsUnavailable (const char *Path)
default: default:
return; return;
} }
TL_DB_MarkNotesChildrenOfFolderAsUnavailable (NoteType, Tml_DB_MarkNotesChildrenOfFolderAsUnavailable (NoteType,
FileBrowser,Brw_GetCodForFiles (), FileBrowser,Brw_GetCodForFiles (),
Path); Path);
break; break;
@ -1058,7 +1058,7 @@ void TL_Not_MarkNotesChildrenOfFolderAsUnavailable (const char *Path)
/****************** Put parameter with the code of a note ********************/ /****************** Put parameter with the code of a note ********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_PutHiddenParamNotCod (long NotCod) void Tml_Not_PutHiddenParamNotCod (long NotCod)
{ {
Par_PutHiddenParamLong (NULL,"NotCod",NotCod); Par_PutHiddenParamLong (NULL,"NotCod",NotCod);
} }
@ -1067,7 +1067,7 @@ void TL_Not_PutHiddenParamNotCod (long NotCod)
/****************** Get parameter with the code of a note ********************/ /****************** Get parameter with the code of a note ********************/
/*****************************************************************************/ /*****************************************************************************/
long TL_Not_GetParamNotCod (void) long Tml_Not_GetParamNotCod (void)
{ {
/***** Get note code *****/ /***** Get note code *****/
return Par_GetParToLong ("NotCod"); return Par_GetParToLong ("NotCod");
@ -1077,12 +1077,12 @@ long TL_Not_GetParamNotCod (void)
/*********************** Request the removal of a note ***********************/ /*********************** Request the removal of a note ***********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_RequestRemNoteUsr (void) void Tml_Not_RequestRemNoteUsr (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
@ -1094,76 +1094,76 @@ void TL_Not_RequestRemNoteUsr (void)
HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID); HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID);
/***** Request the removal of note *****/ /***** Request the removal of note *****/
TL_Not_RequestRemovalNote (&Timeline); Tml_Not_RequestRemovalNote (&Timeline);
/***** Write timeline again (user) *****/ /***** Write timeline again (user) *****/
TL_ShowTimelineUsr (&Timeline); Tml_ShowTimelineUsr (&Timeline);
/***** End section *****/ /***** End section *****/
HTM_SECTION_End (); HTM_SECTION_End ();
} }
void TL_Not_RequestRemNoteGbl (void) void Tml_Not_RequestRemNoteGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Initialize timeline *****/ /***** Initialize timeline *****/
TL_InitTimelineGbl (&Timeline); Tml_InitTimelineGbl (&Timeline);
/***** Request the removal of note *****/ /***** Request the removal of note *****/
TL_Not_RequestRemovalNote (&Timeline); Tml_Not_RequestRemovalNote (&Timeline);
/***** Write timeline again (global) *****/ /***** Write timeline again (global) *****/
TL_ShowNoteAndTimelineGbl (&Timeline); Tml_ShowNoteAndTimelineGbl (&Timeline);
} }
static void TL_Not_RequestRemovalNote (struct TL_Timeline *Timeline) static void Tml_Not_RequestRemovalNote (struct Tml_Timeline *Timeline)
{ {
extern const char *Txt_Do_you_really_want_to_remove_the_following_post; extern const char *Txt_Do_you_really_want_to_remove_the_following_post;
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Get data of note *****/ /***** Get data of note *****/
Not.NotCod = TL_Not_GetParamNotCod (); Not.NotCod = Tml_Not_GetParamNotCod ();
TL_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
/***** Do some checks *****/ /***** Do some checks *****/
if (!TL_Usr_CheckIfICanRemove (Not.NotCod,Not.UsrCod)) if (!Tml_Usr_CheckIfICanRemove (Not.NotCod,Not.UsrCod))
return; return;
/***** Show question and button to remove note *****/ /***** Show question and button to remove note *****/
/* Begin alert */ /* Begin alert */
TL_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_post); Tml_Frm_BeginAlertRemove (Txt_Do_you_really_want_to_remove_the_following_post);
/* Show note */ /* Show note */
Box_BoxBegin (NULL,NULL, Box_BoxBegin (NULL,NULL,
NULL,NULL, NULL,NULL,
NULL,Box_CLOSABLE); NULL,Box_CLOSABLE);
HTM_DIV_Begin ("class=\"TL_WIDTH\""); HTM_DIV_Begin ("class=\"TL_WIDTH\"");
TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not, Tml_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not,
TL_TOP_MESSAGE_NONE, Tml_TOP_MESSAGE_NONE,
-1L); -1L);
HTM_DIV_End (); HTM_DIV_End ();
Box_BoxEnd (); Box_BoxEnd ();
/* End alert */ /* End alert */
Timeline->NotCod = Not.NotCod; // Note to be removed Timeline->NotCod = Not.NotCod; // Note to be removed
TL_Frm_EndAlertRemove (Timeline,TL_Frm_REM_NOTE, Tml_Frm_EndAlertRemove (Timeline,Tml_Frm_REM_NOTE,
TL_Not_PutParamsRemoveNote); Tml_Not_PutParamsRemoveNote);
} }
/*****************************************************************************/ /*****************************************************************************/
/********************* Put parameters to remove a note ***********************/ /********************* Put parameters to remove a note ***********************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_PutParamsRemoveNote (void *Timeline) static void Tml_Not_PutParamsRemoveNote (void *Timeline)
{ {
if (Timeline) if (Timeline)
{ {
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) // User's timeline if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) // User's timeline
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod); Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
else // Global timeline else // Global timeline
Usr_PutHiddenParamWho (((struct TL_Timeline *) Timeline)->Who); Usr_PutHiddenParamWho (((struct Tml_Timeline *) Timeline)->Who);
TL_Not_PutHiddenParamNotCod (((struct TL_Timeline *) Timeline)->NotCod); Tml_Not_PutHiddenParamNotCod (((struct Tml_Timeline *) Timeline)->NotCod);
} }
} }
@ -1171,12 +1171,12 @@ static void TL_Not_PutParamsRemoveNote (void *Timeline)
/******************************* Remove a note *******************************/ /******************************* Remove a note *******************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_RemoveNoteUsr (void) void Tml_Not_RemoveNoteUsr (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
@ -1188,38 +1188,38 @@ void TL_Not_RemoveNoteUsr (void)
HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID); HTM_SECTION_Begin (TL_TIMELINE_SECTION_ID);
/***** Remove a note *****/ /***** Remove a note *****/
TL_Not_RemoveNote (); Tml_Not_RemoveNote ();
/***** Write updated timeline after removing (user) *****/ /***** Write updated timeline after removing (user) *****/
TL_ShowTimelineUsr (&Timeline); Tml_ShowTimelineUsr (&Timeline);
/***** End section *****/ /***** End section *****/
HTM_SECTION_End (); HTM_SECTION_End ();
} }
void TL_Not_RemoveNoteGbl (void) void Tml_Not_RemoveNoteGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
/***** Initialize timeline *****/ /***** Initialize timeline *****/
TL_InitTimelineGbl (&Timeline); Tml_InitTimelineGbl (&Timeline);
/***** Remove a note *****/ /***** Remove a note *****/
TL_Not_RemoveNote (); Tml_Not_RemoveNote ();
/***** Write updated timeline after removing (global) *****/ /***** Write updated timeline after removing (global) *****/
TL_ShowNoteAndTimelineGbl (&Timeline); Tml_ShowNoteAndTimelineGbl (&Timeline);
} }
static void TL_Not_RemoveNote (void) static void Tml_Not_RemoveNote (void)
{ {
extern const char *Txt_The_post_no_longer_exists; extern const char *Txt_The_post_no_longer_exists;
extern const char *Txt_TIMELINE_Post_removed; extern const char *Txt_TIMELINE_Post_removed;
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Get data of note *****/ /***** Get data of note *****/
Not.NotCod = TL_Not_GetParamNotCod (); Not.NotCod = Tml_Not_GetParamNotCod ();
TL_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
/***** Trivial check 1: note code should be > 0 *****/ /***** Trivial check 1: note code should be > 0 *****/
if (Not.NotCod <= 0) if (Not.NotCod <= 0)
@ -1236,10 +1236,10 @@ static void TL_Not_RemoveNote (void)
} }
/***** Delete note from database *****/ /***** Delete note from database *****/
TL_Not_RemoveNoteMediaAndDBEntries (&Not); Tml_Not_RemoveNoteMediaAndDBEntries (&Not);
/***** Reset note *****/ /***** Reset note *****/
TL_Not_ResetNote (&Not); Tml_Not_ResetNote (&Not);
/***** Message of success *****/ /***** Message of success *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_TIMELINE_Post_removed); Ale_ShowAlert (Ale_SUCCESS,Txt_TIMELINE_Post_removed);
@ -1249,7 +1249,7 @@ static void TL_Not_RemoveNote (void)
/*********************** Remove a note from database *************************/ /*********************** Remove a note from database *************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not) static void Tml_Not_RemoveNoteMediaAndDBEntries (struct Tml_Not_Note *Not)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1260,7 +1260,7 @@ static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not)
/***** Remove comments associated to this note *****/ /***** Remove comments associated to this note *****/
/* Get comments of this note */ /* Get comments of this note */
NumComms = TL_DB_GetComms (Not->NotCod,&mysql_res); NumComms = Tml_DB_GetComms (Not->NotCod,&mysql_res);
/* For each comment... */ /* For each comment... */
for (NumComm = 0; for (NumComm = 0;
@ -1273,7 +1273,7 @@ static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not)
/* Remove media associated to comment /* Remove media associated to comment
and delete comment from database */ and delete comment from database */
TL_Com_RemoveCommMediaAndDBEntries (PubCod); Tml_Com_RemoveCommMediaAndDBEntries (PubCod);
} }
/* Free structure that stores the query result */ /* Free structure that stores the query result */
@ -1281,12 +1281,12 @@ static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not)
/***** Remove media associated to post *****/ /***** Remove media associated to post *****/
if (Not->NoteType == TL_NOTE_POST) if (Not->NoteType == TL_NOTE_POST)
if ((MedCod = TL_DB_GetMedCodFromPost (Not->Cod)) > 0) if ((MedCod = Tml_DB_GetMedCodFromPost (Not->Cod)) > 0)
Med_RemoveMedia (MedCod); Med_RemoveMedia (MedCod);
/***** Mark possible notifications on the publications /***** Mark possible notifications on the publications
of this note as removed *****/ of this note as removed *****/
PubCod = TL_DB_GetPubCodOfOriginalNote (Not->NotCod); PubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod);
if (PubCod > 0) if (PubCod > 0)
{ {
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_FAV ,PubCod); Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_FAV ,PubCod);
@ -1295,24 +1295,24 @@ static void TL_Not_RemoveNoteMediaAndDBEntries (struct TL_Not_Note *Not)
} }
/***** Remove favs for this note *****/ /***** Remove favs for this note *****/
TL_DB_RemoveNoteFavs (Not->NotCod); Tml_DB_RemoveNoteFavs (Not->NotCod);
/***** Remove all publications of this note *****/ /***** Remove all publications of this note *****/
TL_DB_RemoveNotePubs (Not->NotCod); Tml_DB_RemoveNotePubs (Not->NotCod);
/***** Remove note *****/ /***** Remove note *****/
TL_DB_RemoveNote (Not->NotCod); Tml_DB_RemoveNote (Not->NotCod);
if (Not->NoteType == TL_NOTE_POST) if (Not->NoteType == TL_NOTE_POST)
/***** Remove post *****/ /***** Remove post *****/
TL_DB_RemovePost (Not->Cod); Tml_DB_RemovePost (Not->Cod);
} }
/*****************************************************************************/ /*****************************************************************************/
/************************ Get data of note from row **************************/ /************************ Get data of note from row **************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_GetDataOfNoteFromRow (MYSQL_ROW row,struct TL_Not_Note *Not) static void Tml_Not_GetDataOfNoteFromRow (MYSQL_ROW row,struct Tml_Not_Note *Not)
{ {
/* /*
row[0]: NotCod row[0]: NotCod
@ -1327,7 +1327,7 @@ static void TL_Not_GetDataOfNoteFromRow (MYSQL_ROW row,struct TL_Not_Note *Not)
Not->NotCod = Str_ConvertStrCodToLongCod (row[0]); Not->NotCod = Str_ConvertStrCodToLongCod (row[0]);
/***** Get note type (row[1]) *****/ /***** Get note type (row[1]) *****/
Not->NoteType = TL_Not_GetNoteTypeFromStr (row[1]); Not->NoteType = Tml_Not_GetNoteTypeFromStr (row[1]);
/***** Get file/post... code (row[2]) *****/ /***** Get file/post... code (row[2]) *****/
Not->Cod = Str_ConvertStrCodToLongCod (row[2]); Not->Cod = Str_ConvertStrCodToLongCod (row[2]);
@ -1345,10 +1345,10 @@ static void TL_Not_GetDataOfNoteFromRow (MYSQL_ROW row,struct TL_Not_Note *Not)
Not->DateTimeUTC = Dat_GetUNIXTimeFromStr (row[6]); Not->DateTimeUTC = Dat_GetUNIXTimeFromStr (row[6]);
/***** Get number of times this note has been shared *****/ /***** Get number of times this note has been shared *****/
Not->NumShared = TL_DB_GetNumSharers (Not->NotCod,Not->UsrCod); Not->NumShared = Tml_DB_GetNumSharers (Not->NotCod,Not->UsrCod);
/***** Get number of times this note has been favourited *****/ /***** Get number of times this note has been favourited *****/
Not->NumFavs = TL_DB_GetNumFavers (TL_Usr_FAV_UNF_NOTE, Not->NumFavs = Tml_DB_GetNumFavers (Tml_Usr_FAV_UNF_NOTE,
Not->NotCod,Not->UsrCod); Not->NotCod,Not->UsrCod);
} }
@ -1356,13 +1356,13 @@ static void TL_Not_GetDataOfNoteFromRow (MYSQL_ROW row,struct TL_Not_Note *Not)
/********* Get note type from string number coming from database *************/ /********* Get note type from string number coming from database *************/
/*****************************************************************************/ /*****************************************************************************/
static TL_Not_NoteType_t TL_Not_GetNoteTypeFromStr (const char *Str) static Tml_Not_NoteType_t Tml_Not_GetNoteTypeFromStr (const char *Str)
{ {
unsigned UnsignedNum; unsigned UnsignedNum;
if (sscanf (Str,"%u",&UnsignedNum) == 1) if (sscanf (Str,"%u",&UnsignedNum) == 1)
if (UnsignedNum < TL_NOT_NUM_NOTE_TYPES) if (UnsignedNum < TL_NOT_NUM_NOTE_TYPES)
return (TL_Not_NoteType_t) UnsignedNum; return (Tml_Not_NoteType_t) UnsignedNum;
return TL_NOTE_UNKNOWN; return TL_NOTE_UNKNOWN;
} }
@ -1371,7 +1371,7 @@ static TL_Not_NoteType_t TL_Not_GetNoteTypeFromStr (const char *Str)
/*************************** Reset fields of note ****************************/ /*************************** Reset fields of note ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Not_ResetNote (struct TL_Not_Note *Not) static void Tml_Not_ResetNote (struct Tml_Not_Note *Not)
{ {
Not->NotCod = -1L; Not->NotCod = -1L;
Not->NoteType = TL_NOTE_UNKNOWN; Not->NoteType = TL_NOTE_UNKNOWN;
@ -1387,7 +1387,7 @@ static void TL_Not_ResetNote (struct TL_Not_Note *Not)
/******************** Get data of note using its code ************************/ /******************** Get data of note using its code ************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_GetDataOfNoteByCod (struct TL_Not_Note *Not) void Tml_Not_GetDataOfNoteByCod (struct Tml_Not_Note *Not)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -1396,20 +1396,20 @@ void TL_Not_GetDataOfNoteByCod (struct TL_Not_Note *Not)
if (Not->NotCod <= 0) if (Not->NotCod <= 0)
{ {
/***** Reset fields of note *****/ /***** Reset fields of note *****/
TL_Not_ResetNote (Not); Tml_Not_ResetNote (Not);
return; return;
} }
/***** Get data of note from database *****/ /***** Get data of note from database *****/
if (TL_DB_GetDataOfNoteByCod (Not->NotCod,&mysql_res)) if (Tml_DB_GetDataOfNoteByCod (Not->NotCod,&mysql_res))
{ {
/***** Get data of note *****/ /***** Get data of note *****/
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
TL_Not_GetDataOfNoteFromRow (row,Not); Tml_Not_GetDataOfNoteFromRow (row,Not);
} }
else else
/***** Reset fields of note *****/ /***** Reset fields of note *****/
TL_Not_ResetNote (Not); Tml_Not_ResetNote (Not);
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);

View File

@ -1,7 +1,7 @@
// swad_timeline_note.h: social timeline notes // swad_timeline_note.h: social timeline notes
#ifndef _SWAD_TL_NOT #ifndef _SWAD_TML_NOT
#define _SWAD_TL_NOT #define _SWAD_TML_NOT
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -65,12 +65,12 @@ typedef enum
TL_NOTE_FORUM_POST = 11, // Post in global/swad forums TL_NOTE_FORUM_POST = 11, // Post in global/swad forums
/* Analytics tab */ /* Analytics tab */
/* Profile tab */ /* Profile tab */
} TL_Not_NoteType_t; } Tml_Not_NoteType_t;
struct TL_Not_Note struct Tml_Not_Note
{ {
long NotCod; // Unique code/identifier for each note long NotCod; // Unique code/identifier for each note
TL_Not_NoteType_t NoteType; // Timeline post, public file, exam announcement, notice, forum post... Tml_Not_NoteType_t NoteType; // Timeline post, public file, exam announcement, notice, forum post...
long UsrCod; // Publisher long UsrCod; // Publisher
long HieCod; // Hierarchy code (institution/centre/degree/course) long HieCod; // Hierarchy code (institution/centre/degree/course)
long Cod; // Code of file, forum post, notice, timeline post... long Cod; // Code of file, forum post, notice, timeline post...
@ -84,33 +84,33 @@ struct TL_Not_Note
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Not_ShowHighlightedNote (struct TL_Timeline *Timeline, void Tml_Not_ShowHighlightedNote (struct Tml_Timeline *Timeline,
struct TL_Not_Note *Not); struct Tml_Not_Note *Not);
void TL_Not_CheckAndWriteNoteWithTopMsg (const struct TL_Timeline *Timeline, void Tml_Not_CheckAndWriteNoteWithTopMsg (const struct Tml_Timeline *Timeline,
const struct TL_Not_Note *Not, const struct Tml_Not_Note *Not,
TL_TopMessage_t TopMessage, Tml_TopMessage_t TopMessage,
long PublisherCod); long PublisherCod);
void TL_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique); void Tml_Not_ShowAuthorPhoto (struct UsrData *UsrDat,bool FormUnique);
void TL_Not_WriteAuthorName (const struct UsrData *UsrDat); void Tml_Not_WriteAuthorName (const struct UsrData *UsrDat);
void TL_Not_GetNoteSummary (const struct TL_Not_Note *Not, void Tml_Not_GetNoteSummary (const struct Tml_Not_Note *Not,
char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]); char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1]);
void TL_Not_StoreAndPublishNote (TL_Not_NoteType_t NoteType,long Cod); void Tml_Not_StoreAndPublishNote (Tml_Not_NoteType_t NoteType,long Cod);
void TL_Not_StoreAndPublishNoteInternal (TL_Not_NoteType_t NoteType,long Cod, void Tml_Not_StoreAndPublishNoteInternal (Tml_Not_NoteType_t NoteType,long Cod,
struct TL_Pub_Publication *Pub); struct Tml_Pub_Publication *Pub);
void TL_Not_MarkNoteOneFileAsUnavailable (const char *Path); void Tml_Not_MarkNoteOneFileAsUnavailable (const char *Path);
void TL_Not_MarkNotesChildrenOfFolderAsUnavailable (const char *Path); void Tml_Not_MarkNotesChildrenOfFolderAsUnavailable (const char *Path);
void TL_Not_PutHiddenParamNotCod (long NotCod); void Tml_Not_PutHiddenParamNotCod (long NotCod);
long TL_Not_GetParamNotCod (void); long Tml_Not_GetParamNotCod (void);
void TL_Not_RequestRemNoteUsr (void); void Tml_Not_RequestRemNoteUsr (void);
void TL_Not_RequestRemNoteGbl (void); void Tml_Not_RequestRemNoteGbl (void);
void TL_Not_RemoveNoteUsr (void); void Tml_Not_RemoveNoteUsr (void);
void TL_Not_RemoveNoteGbl (void); void Tml_Not_RemoveNoteGbl (void);
void TL_Not_GetDataOfNoteByCod (struct TL_Not_Note *Not); void Tml_Not_GetDataOfNoteByCod (struct Tml_Not_Note *Not);
#endif #endif

View File

@ -62,8 +62,8 @@ extern struct Globals Gbl;
/*********** Create a notification for the author of a post/comment **********/ /*********** Create a notification for the author of a post/comment **********/
/*****************************************************************************/ /*****************************************************************************/
void TL_Ntf_CreateNotifToAuthor (long AuthorCod,long PubCod, void Tml_Ntf_CreateNotifToAuthor (long AuthorCod,long PubCod,
Ntf_NotifyEvent_t NotifyEvent) Ntf_NotifyEvent_t NotifyEvent)
{ {
struct UsrData UsrDat; struct UsrData UsrDat;
bool CreateNotif; bool CreateNotif;
@ -101,27 +101,27 @@ void TL_Ntf_CreateNotifToAuthor (long AuthorCod,long PubCod,
/***************** Get notification of a new publication *********************/ /***************** Get notification of a new publication *********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Ntf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Tml_Ntf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr, char **ContentStr,
long PubCod,bool GetContent) long PubCod,bool GetContent)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
struct TL_Pub_Publication Pub; struct Tml_Pub_Publication Pub;
struct TL_Not_Note Not; struct Tml_Not_Note Not;
struct TL_Pst_Content Content; struct Tml_Pst_Content Content;
size_t Length; size_t Length;
bool ContentCopied = false; bool ContentCopied = false;
/***** Return nothing on error *****/ /***** Return nothing on error *****/
Pub.PubType = TL_Pub_UNKNOWN; Pub.PubType = Tml_Pub_UNKNOWN;
SummaryStr[0] = '\0'; // Return nothing on error SummaryStr[0] = '\0'; // Return nothing on error
Content.Txt[0] = '\0'; Content.Txt[0] = '\0';
/***** Get summary and content from post from database *****/ /***** Get summary and content from post from database *****/
if (TL_DB_GetDataOfPubByCod (PubCod,&mysql_res) == 1) // Result should have a unique row if (Tml_DB_GetDataOfPubByCod (PubCod,&mysql_res) == 1) // Result should have a unique row
/* Get data of publication from row */ /* Get data of publication from row */
TL_Pub_GetDataOfPubFromNextRow (mysql_res,&Pub); Tml_Pub_GetDataOfPubFromNextRow (mysql_res,&Pub);
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res); DB_FreeMySQLResult (&mysql_res);
@ -129,18 +129,18 @@ void TL_Ntf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
/***** Get summary and content *****/ /***** Get summary and content *****/
switch (Pub.PubType) switch (Pub.PubType)
{ {
case TL_Pub_UNKNOWN: case Tml_Pub_UNKNOWN:
break; break;
case TL_Pub_ORIGINAL_NOTE: case Tml_Pub_ORIGINAL_NOTE:
case TL_Pub_SHARED_NOTE: case Tml_Pub_SHARED_NOTE:
/* Get data of note */ /* Get data of note */
Not.NotCod = Pub.NotCod; Not.NotCod = Pub.NotCod;
TL_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
if (Not.NoteType == TL_NOTE_POST) if (Not.NoteType == TL_NOTE_POST)
{ {
/***** Get post from database *****/ /***** Get post from database *****/
if (TL_DB_GetPostByCod (Not.Cod,&mysql_res) == 1) // Result should have a unique row if (Tml_DB_GetPostByCod (Not.Cod,&mysql_res) == 1) // Result should have a unique row
{ {
/* Get row */ /* Get row */
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
@ -168,11 +168,11 @@ void TL_Ntf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
Str_Copy (SummaryStr,Content.Txt,Ntf_MAX_BYTES_SUMMARY); Str_Copy (SummaryStr,Content.Txt,Ntf_MAX_BYTES_SUMMARY);
} }
else else
TL_Not_GetNoteSummary (&Not,SummaryStr); Tml_Not_GetNoteSummary (&Not,SummaryStr);
break; break;
case TL_Pub_COMMENT_TO_NOTE: case Tml_Pub_COMMENT_TO_NOTE:
/***** Get content of comment from database *****/ /***** Get content of comment from database *****/
if (TL_DB_GetDataOfCommByCod (Pub.PubCod,&mysql_res) == 1) // Result should have a unique row if (Tml_DB_GetDataOfCommByCod (Pub.PubCod,&mysql_res) == 1) // Result should have a unique row
{ {
/* Get row */ /* Get row */
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
@ -212,7 +212,7 @@ void TL_Ntf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
/*****************************************************************************/ /*****************************************************************************/
// Must be executed as a priori function // Must be executed as a priori function
void TL_Ntf_MarkMyNotifAsSeen (void) void Tml_Ntf_MarkMyNotifAsSeen (void)
{ {
Ntf_MarkNotifAsSeen (Ntf_EVENT_TL_COMMENT,-1L,-1L,Gbl.Usrs.Me.UsrDat.UsrCod); Ntf_MarkNotifAsSeen (Ntf_EVENT_TL_COMMENT,-1L,-1L,Gbl.Usrs.Me.UsrDat.UsrCod);
Ntf_MarkNotifAsSeen (Ntf_EVENT_TL_FAV ,-1L,-1L,Gbl.Usrs.Me.UsrDat.UsrCod); Ntf_MarkNotifAsSeen (Ntf_EVENT_TL_FAV ,-1L,-1L,Gbl.Usrs.Me.UsrDat.UsrCod);

View File

@ -1,7 +1,7 @@
// swad_timeline_notification.h: social timeline notifications // swad_timeline_notification.h: social timeline notifications
#ifndef _SWAD_TL_NTF #ifndef _SWAD_TML_NTF
#define _SWAD_TL_NTF #define _SWAD_TML_NTF
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -41,13 +41,13 @@
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Ntf_CreateNotifToAuthor (long AuthorCod,long PubCod, void Tml_Ntf_CreateNotifToAuthor (long AuthorCod,long PubCod,
Ntf_NotifyEvent_t NotifyEvent); Ntf_NotifyEvent_t NotifyEvent);
void TL_Ntf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Tml_Ntf_GetNotifPublication (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr, char **ContentStr,
long PubCod,bool GetContent); long PubCod,bool GetContent);
void TL_Ntf_MarkMyNotifAsSeen (void); void Tml_Ntf_MarkMyNotifAsSeen (void);
#endif #endif

View File

@ -46,7 +46,7 @@
/************************* Private constants and types ***********************/ /************************* Private constants and types ***********************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_Pst_MAX_CHARS_IN_POST 1000 // Maximum number of characters in a post #define Tml_Pst_MAX_CHARS_IN_POST 1000 // Maximum number of characters in a post
/*****************************************************************************/ /*****************************************************************************/
/************** External global variables from others modules ****************/ /************** External global variables from others modules ****************/
@ -62,29 +62,29 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Pst_GetPostContent (long PstCod,struct TL_Pst_Content *Content); static void Tml_Pst_GetPostContent (long PstCod,struct Tml_Pst_Content *Content);
static void TL_Pst_ShowPostContent (struct TL_Pst_Content *Content); static void Tml_Pst_ShowPostContent (struct Tml_Pst_Content *Content);
static void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline); static void Tml_Pst_PutFormToWriteNewPost (struct Tml_Timeline *Timeline);
static long TL_Pst_ReceivePost (void); static long Tml_Pst_ReceivePost (void);
/*****************************************************************************/ /*****************************************************************************/
/***************** Get from database and write public post *******************/ /***************** Get from database and write public post *******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pst_GetAndWritePost (long PstCod) void Tml_Pst_GetAndWritePost (long PstCod)
{ {
struct TL_Pst_Content Content; struct Tml_Pst_Content Content;
/***** Initialize media *****/ /***** Initialize media *****/
Med_MediaConstructor (&Content.Media); Med_MediaConstructor (&Content.Media);
/***** Get post content from database *****/ /***** Get post content from database *****/
TL_Pst_GetPostContent (PstCod,&Content); Tml_Pst_GetPostContent (PstCod,&Content);
/***** Show post content *****/ /***** Show post content *****/
TL_Pst_ShowPostContent (&Content); Tml_Pst_ShowPostContent (&Content);
/***** Free media *****/ /***** Free media *****/
Med_MediaDestructor (&Content.Media); Med_MediaDestructor (&Content.Media);
@ -95,13 +95,13 @@ void TL_Pst_GetAndWritePost (long PstCod)
/*****************************************************************************/ /*****************************************************************************/
// Media must be initialized before calling this function // Media must be initialized before calling this function
static void TL_Pst_GetPostContent (long PstCod,struct TL_Pst_Content *Content) static void Tml_Pst_GetPostContent (long PstCod,struct Tml_Pst_Content *Content)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
/***** Get post from database *****/ /***** Get post from database *****/
if (TL_DB_GetPostByCod (PstCod,&mysql_res) == 1) if (Tml_DB_GetPostByCod (PstCod,&mysql_res) == 1)
{ {
/* Get row */ /* Get row */
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
@ -127,7 +127,7 @@ static void TL_Pst_GetPostContent (long PstCod,struct TL_Pst_Content *Content)
/****************************** Get post content *****************************/ /****************************** Get post content *****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Pst_ShowPostContent (struct TL_Pst_Content *Content) static void Tml_Pst_ShowPostContent (struct Tml_Pst_Content *Content)
{ {
/***** Write content text *****/ /***** Write content text *****/
if (Content->Txt[0]) if (Content->Txt[0])
@ -146,7 +146,7 @@ static void TL_Pst_ShowPostContent (struct TL_Pst_Content *Content)
/********************** Form to write a new publication **********************/ /********************** Form to write a new publication **********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pst_PutPhotoAndFormToWriteNewPost (struct TL_Timeline *Timeline) void Tml_Pst_PutPhotoAndFormToWriteNewPost (struct Tml_Timeline *Timeline)
{ {
/***** Begin list *****/ /***** Begin list *****/
HTM_UL_Begin ("class=\"TL_LIST\""); HTM_UL_Begin ("class=\"TL_LIST\"");
@ -155,10 +155,10 @@ void TL_Pst_PutPhotoAndFormToWriteNewPost (struct TL_Timeline *Timeline)
HTM_LI_Begin ("class=\"TL_WIDTH\""); HTM_LI_Begin ("class=\"TL_WIDTH\"");
/***** Left: write author's photo (my photo) *****/ /***** Left: write author's photo (my photo) *****/
TL_Not_ShowAuthorPhoto (&Gbl.Usrs.Me.UsrDat,false); // Don't use unique id Tml_Not_ShowAuthorPhoto (&Gbl.Usrs.Me.UsrDat,false); // Don't use unique id
/***** Right: author's name, time, textarea *****/ /***** Right: author's name, time, textarea *****/
TL_Pst_PutFormToWriteNewPost (Timeline); Tml_Pst_PutFormToWriteNewPost (Timeline);
/***** End list item *****/ /***** End list item *****/
HTM_LI_End (); HTM_LI_End ();
@ -171,7 +171,7 @@ void TL_Pst_PutPhotoAndFormToWriteNewPost (struct TL_Timeline *Timeline)
/**************** Author's name, time, and form with textarea ****************/ /**************** Author's name, time, and form with textarea ****************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline) static void Tml_Pst_PutFormToWriteNewPost (struct Tml_Timeline *Timeline)
{ {
extern const char *Txt_New_TIMELINE_post; extern const char *Txt_New_TIMELINE_post;
@ -179,17 +179,17 @@ static void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline)
HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\""); HTM_DIV_Begin ("class=\"TL_RIGHT_CONT TL_RIGHT_WIDTH\"");
/***** Author name *****/ /***** Author name *****/
TL_Not_WriteAuthorName (&Gbl.Usrs.Me.UsrDat); Tml_Not_WriteAuthorName (&Gbl.Usrs.Me.UsrDat);
/***** Form to write the post *****/ /***** Form to write the post *****/
/* Begin container */ /* Begin container */
HTM_DIV_Begin ("class=\"TL_FORM_NEW_PST TL_RIGHT_WIDTH\""); HTM_DIV_Begin ("class=\"TL_FORM_NEW_PST TL_RIGHT_WIDTH\"");
/* Form with textarea */ /* Form with textarea */
TL_Frm_BeginForm (Timeline,TL_Frm_RECEIVE_POST); Tml_Frm_BeginForm (Timeline,Tml_Frm_RECEIVE_POST);
TL_Pst_PutTextarea (Txt_New_TIMELINE_post, Tml_Pst_PutTextarea (Txt_New_TIMELINE_post,
"TL_PST_TEXTAREA TL_RIGHT_WIDTH"); "TL_PST_TEXTAREA TL_RIGHT_WIDTH");
TL_Frm_EndForm (); Tml_Frm_EndForm ();
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();
@ -202,7 +202,7 @@ static void TL_Pst_PutFormToWriteNewPost (struct TL_Timeline *Timeline)
/*** Put textarea and button inside a form to submit a new post or comment ***/ /*** Put textarea and button inside a form to submit a new post or comment ***/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pst_PutTextarea (const char *Placeholder,const char *ClassTextArea) void Tml_Pst_PutTextarea (const char *Placeholder,const char *ClassTextArea)
{ {
extern const char *Txt_Post; extern const char *Txt_Post;
char IdDivImgButton[Frm_MAX_BYTES_ID + 1]; char IdDivImgButton[Frm_MAX_BYTES_ID + 1];
@ -214,7 +214,7 @@ void TL_Pst_PutTextarea (const char *Placeholder,const char *ClassTextArea)
HTM_TEXTAREA_Begin ("name=\"Txt\" rows=\"1\" maxlength=\"%u\"" HTM_TEXTAREA_Begin ("name=\"Txt\" rows=\"1\" maxlength=\"%u\""
" placeholder=\"%s&hellip;\" class=\"%s\"" " placeholder=\"%s&hellip;\" class=\"%s\""
" onfocus=\"expandTextarea(this,'%s','6');\"", " onfocus=\"expandTextarea(this,'%s','6');\"",
TL_Pst_MAX_CHARS_IN_POST, Tml_Pst_MAX_CHARS_IN_POST,
Placeholder,ClassTextArea, Placeholder,ClassTextArea,
IdDivImgButton); IdDivImgButton);
HTM_TEXTAREA_End (); HTM_TEXTAREA_End ();
@ -241,13 +241,13 @@ void TL_Pst_PutTextarea (const char *Placeholder,const char *ClassTextArea)
/******************* Receive and store a new public post *********************/ /******************* Receive and store a new public post *********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pst_ReceivePostUsr (void) void Tml_Pst_ReceivePostUsr (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
long NotCod; long NotCod;
/***** Reset timeline context *****/ /***** Reset timeline context *****/
TL_ResetTimeline (&Timeline); Tml_ResetTimeline (&Timeline);
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
@ -260,34 +260,34 @@ void TL_Pst_ReceivePostUsr (void)
/***** Receive and store post, and /***** Receive and store post, and
write updated timeline after publication (user) *****/ write updated timeline after publication (user) *****/
NotCod = TL_Pst_ReceivePost (); NotCod = Tml_Pst_ReceivePost ();
TL_ShowTimelineUsrHighlighting (&Timeline,NotCod); Tml_ShowTimelineUsrHighlighting (&Timeline,NotCod);
/***** End section *****/ /***** End section *****/
HTM_SECTION_End (); HTM_SECTION_End ();
} }
void TL_Pst_ReceivePostGbl (void) void Tml_Pst_ReceivePostGbl (void)
{ {
struct TL_Timeline Timeline; struct Tml_Timeline Timeline;
long NotCod; long NotCod;
/***** Initialize timeline *****/ /***** Initialize timeline *****/
TL_InitTimelineGbl (&Timeline); Tml_InitTimelineGbl (&Timeline);
/***** Receive and store post *****/ /***** Receive and store post *****/
NotCod = TL_Pst_ReceivePost (); NotCod = Tml_Pst_ReceivePost ();
/***** Write updated timeline after publication (global) *****/ /***** Write updated timeline after publication (global) *****/
TL_ShowTimelineGblHighlighting (&Timeline,NotCod); Tml_ShowTimelineGblHighlighting (&Timeline,NotCod);
} }
// Returns the code of the note just created // Returns the code of the note just created
static long TL_Pst_ReceivePost (void) static long Tml_Pst_ReceivePost (void)
{ {
struct TL_Pst_Content Content; struct Tml_Pst_Content Content;
long PstCod; long PstCod;
struct TL_Pub_Publication Pub; struct Tml_Pub_Publication Pub;
/***** Get the content of the new post *****/ /***** Get the content of the new post *****/
Par_GetParAndChangeFormat ("Txt",Content.Txt,Cns_MAX_BYTES_LONG_TEXT, Par_GetParAndChangeFormat ("Txt",Content.Txt,Cns_MAX_BYTES_LONG_TEXT,
@ -297,9 +297,9 @@ static long TL_Pst_ReceivePost (void)
Med_MediaConstructor (&Content.Media); Med_MediaConstructor (&Content.Media);
/***** Get attached image (action, file and title) *****/ /***** Get attached image (action, file and title) *****/
Content.Media.Width = TL_IMAGE_SAVED_MAX_WIDTH; Content.Media.Width = Tml_IMAGE_SAVED_MAX_WIDTH;
Content.Media.Height = TL_IMAGE_SAVED_MAX_HEIGHT; Content.Media.Height = Tml_IMAGE_SAVED_MAX_HEIGHT;
Content.Media.Quality = TL_IMAGE_SAVED_QUALITY; Content.Media.Quality = Tml_IMAGE_SAVED_QUALITY;
Med_GetMediaFromForm (-1L,-1L,-1,&Content.Media,NULL,NULL); Med_GetMediaFromForm (-1L,-1L,-1,&Content.Media,NULL,NULL);
Ale_ShowAlerts (NULL); Ale_ShowAlerts (NULL);
@ -311,10 +311,10 @@ static long TL_Pst_ReceivePost (void)
/***** Publish *****/ /***** Publish *****/
/* Insert post content in the database */ /* Insert post content in the database */
PstCod = TL_DB_CreateNewPost (&Content); PstCod = Tml_DB_CreateNewPost (&Content);
/* Insert post in notes */ /* Insert post in notes */
TL_Not_StoreAndPublishNoteInternal (TL_NOTE_POST,PstCod,&Pub); Tml_Not_StoreAndPublishNoteInternal (TL_NOTE_POST,PstCod,&Pub);
/***** Analyze content and store notifications about mentions *****/ /***** Analyze content and store notifications about mentions *****/
Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (Pub.PubCod,Content.Txt); Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (Pub.PubCod,Content.Txt);

View File

@ -1,7 +1,7 @@
// swad_timeline_post.h: social timeline posts // swad_timeline_post.h: social timeline posts
#ifndef _SWAD_TL_PST #ifndef _SWAD_TML_PST
#define _SWAD_TL_PST #define _SWAD_TML_PST
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -35,7 +35,7 @@
/******************************** Public types *******************************/ /******************************** Public types *******************************/
/*****************************************************************************/ /*****************************************************************************/
struct TL_Pst_Content struct Tml_Pst_Content
{ {
char Txt[Cns_MAX_BYTES_LONG_TEXT + 1]; char Txt[Cns_MAX_BYTES_LONG_TEXT + 1];
struct Med_Media Media; struct Med_Media Media;
@ -45,12 +45,12 @@ struct TL_Pst_Content
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pst_GetAndWritePost (long PstCod); void Tml_Pst_GetAndWritePost (long PstCod);
void TL_Pst_PutPhotoAndFormToWriteNewPost (struct TL_Timeline *Timeline); void Tml_Pst_PutPhotoAndFormToWriteNewPost (struct Tml_Timeline *Timeline);
void TL_Pst_PutTextarea (const char *Placeholder,const char *ClassTextArea); void Tml_Pst_PutTextarea (const char *Placeholder,const char *ClassTextArea);
void TL_Pst_ReceivePostUsr (void); void Tml_Pst_ReceivePostUsr (void);
void TL_Pst_ReceivePostGbl (void); void Tml_Pst_ReceivePostGbl (void);
#endif #endif

View File

@ -58,54 +58,54 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Pub_InitializeRangeOfPubs (TL_WhatToGet_t WhatToGet, static void Tml_Pub_InitializeRangeOfPubs (Tml_WhatToGet_t WhatToGet,
struct TL_Pub_RangePubsToGet *RangePubsToGet); struct Tml_Pub_RangePubsToGet *RangePubsToGet);
static unsigned TL_Pub_GetMaxPubsToGet (const struct TL_Timeline *Timeline); static unsigned Tml_Pub_GetMaxPubsToGet (const struct Tml_Timeline *Timeline);
static void TL_Pub_UpdateFirstLastPubCodesIntoSession (const struct TL_Timeline *Timeline); static void Tml_Pub_UpdateFirstLastPubCodesIntoSession (const struct Tml_Timeline *Timeline);
static struct TL_Pub_Publication *TL_Pub_SelectTheMostRecentPub (const struct TL_Pub_SubQueries *SubQueries); static struct Tml_Pub_Publication *Tml_Pub_SelectTheMostRecentPub (const struct Tml_Pub_SubQueries *SubQueries);
static TL_Pub_PubType_t TL_Pub_GetPubTypeFromStr (const char *Str); static Tml_Pub_PubType_t Tml_Pub_GetPubTypeFromStr (const char *Str);
/*****************************************************************************/ /*****************************************************************************/
/*************** Get list of pubications to show in timeline *****************/ /*************** Get list of pubications to show in timeline *****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pub_GetListPubsToShowInTimeline (struct TL_Timeline *Timeline) void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline)
{ {
struct TL_Pub_SubQueries SubQueries; struct Tml_Pub_SubQueries SubQueries;
struct TL_Pub_RangePubsToGet RangePubsToGet; struct Tml_Pub_RangePubsToGet RangePubsToGet;
unsigned MaxPubsToGet = TL_Pub_GetMaxPubsToGet (Timeline); unsigned MaxPubsToGet = Tml_Pub_GetMaxPubsToGet (Timeline);
unsigned NumPub; unsigned NumPub;
struct TL_Pub_Publication *Pub; struct Tml_Pub_Publication *Pub;
/***** Initialize range of publications *****/ /***** Initialize range of publications *****/
TL_Pub_InitializeRangeOfPubs (Timeline->WhatToGet,&RangePubsToGet); Tml_Pub_InitializeRangeOfPubs (Timeline->WhatToGet,&RangePubsToGet);
/***** Clear timeline for this session in database *****/ /***** Clear timeline for this session in database *****/
if (Timeline->WhatToGet == TL_GET_RECENT_TIMELINE) if (Timeline->WhatToGet == Tml_GET_RECENT_TIMELINE)
TL_DB_ClearTimelineNotesOfSessionFromDB (); Tml_DB_ClearTimelineNotesOfSessionFromDB ();
/***** Create temporary tables *****/ /***** Create temporary tables *****/
/* Create temporary table with notes just retrieved */ /* Create temporary table with notes just retrieved */
TL_DB_CreateTmpTableJustRetrievedNotes (); Tml_DB_CreateTmpTableJustRetrievedNotes ();
/* Create temporary table with all notes visible in timeline */ /* Create temporary table with all notes visible in timeline */
if (Timeline->WhatToGet == TL_GET_ONLY_OLD_PUBS) if (Timeline->WhatToGet == Tml_GET_ONLY_OLD_PUBS)
TL_DB_CreateTmpTableVisibleTimeline (); Tml_DB_CreateTmpTableVisibleTimeline ();
/***** Create subqueries *****/ /***** Create subqueries *****/
/* Create subquery with potential publishers */ /* Create subquery with potential publishers */
TL_DB_CreateSubQueryPublishers (Timeline,&SubQueries); Tml_DB_CreateSubQueryPublishers (Timeline,&SubQueries);
/* Create subquery to get only notes not present in timeline */ /* Create subquery to get only notes not present in timeline */
TL_DB_CreateSubQueryAlreadyExists (Timeline,&SubQueries); Tml_DB_CreateSubQueryAlreadyExists (Timeline,&SubQueries);
/* Create subquery with bottom range of publications to get from tl_pubs. /* Create subquery with bottom range of publications to get from tl_pubs.
Bottom pub. code remains unchanged in all iterations of the loop. */ Bottom pub. code remains unchanged in all iterations of the loop. */
TL_DB_CreateSubQueryRangeBottom (RangePubsToGet.Bottom,&SubQueries); Tml_DB_CreateSubQueryRangeBottom (RangePubsToGet.Bottom,&SubQueries);
/***** Initialize list of publications *****/ /***** Initialize list of publications *****/
/* Chained list of publications: /* Chained list of publications:
@ -149,10 +149,10 @@ void TL_Pub_GetListPubsToShowInTimeline (struct TL_Timeline *Timeline)
{ {
/* Create subquery with top range of publications to get from tl_pubs /* Create subquery with top range of publications to get from tl_pubs
In each iteration of this loop, top publication code is changed to a lower value */ In each iteration of this loop, top publication code is changed to a lower value */
TL_DB_CreateSubQueryRangeTop (RangePubsToGet.Top,&SubQueries); Tml_DB_CreateSubQueryRangeTop (RangePubsToGet.Top,&SubQueries);
/* Select the most recent publication from tl_pubs */ /* Select the most recent publication from tl_pubs */
Pub = TL_Pub_SelectTheMostRecentPub (&SubQueries); Pub = Tml_Pub_SelectTheMostRecentPub (&SubQueries);
/* Chain the previous publication with the current one */ /* Chain the previous publication with the current one */
if (NumPub == 0) if (NumPub == 0)
@ -166,9 +166,9 @@ void TL_Pub_GetListPubsToShowInTimeline (struct TL_Timeline *Timeline)
/* Insert note in temporary tables with just retrieved notes. /* Insert note in temporary tables with just retrieved notes.
These tables will be used to not get notes already shown */ These tables will be used to not get notes already shown */
TL_DB_InsertNoteInJustRetrievedNotes (Pub->NotCod); Tml_DB_InsertNoteInJustRetrievedNotes (Pub->NotCod);
if (Timeline->WhatToGet == TL_GET_ONLY_OLD_PUBS) // Get only old publications if (Timeline->WhatToGet == Tml_GET_ONLY_OLD_PUBS) // Get only old publications
TL_DB_InsertNoteInVisibleTimeline (Pub->NotCod); Tml_DB_InsertNoteInVisibleTimeline (Pub->NotCod);
/* Narrow the range for the next iteration */ /* Narrow the range for the next iteration */
RangePubsToGet.Top = Pub->PubCod; RangePubsToGet.Top = Pub->PubCod;
@ -176,19 +176,19 @@ void TL_Pub_GetListPubsToShowInTimeline (struct TL_Timeline *Timeline)
/***** Update first (oldest) and last (more recent) publication codes /***** Update first (oldest) and last (more recent) publication codes
into session for next refresh *****/ into session for next refresh *****/
TL_Pub_UpdateFirstLastPubCodesIntoSession (Timeline); Tml_Pub_UpdateFirstLastPubCodesIntoSession (Timeline);
/***** Add notes just retrieved to visible timeline for this session *****/ /***** Add notes just retrieved to visible timeline for this session *****/
TL_DB_AddNotesJustRetrievedToVisibleTimelineOfSession (); Tml_DB_AddNotesJustRetrievedToVisibleTimelineOfSession ();
/***** Drop temporary tables *****/ /***** Drop temporary tables *****/
/* Drop temporary tables with notes already retrieved */ /* Drop temporary tables with notes already retrieved */
TL_DB_DropTmpTableJustRetrievedNotes (); Tml_DB_DropTmpTableJustRetrievedNotes ();
if (Timeline->WhatToGet == TL_GET_ONLY_OLD_PUBS) // Get only old publications if (Timeline->WhatToGet == Tml_GET_ONLY_OLD_PUBS) // Get only old publications
TL_DB_DropTmpTableVisibleTimeline (); Tml_DB_DropTmpTableVisibleTimeline ();
/* Drop temporary table with me and users I follow */ /* Drop temporary table with me and users I follow */
if (Timeline->UsrOrGbl == TL_Usr_TIMELINE_GBL && // Show the global timeline if (Timeline->UsrOrGbl == Tml_Usr_TIMELINE_GBL && // Show the global timeline
Timeline->Who == Usr_WHO_FOLLOWED) // Show the timeline of the users I follow Timeline->Who == Usr_WHO_FOLLOWED) // Show the timeline of the users I follow
Fol_DropTmpTableMeAndUsrsIFollow (); Fol_DropTmpTableMeAndUsrsIFollow ();
} }
@ -197,8 +197,8 @@ void TL_Pub_GetListPubsToShowInTimeline (struct TL_Timeline *Timeline)
/*************** Get list of pubications to show in timeline *****************/ /*************** Get list of pubications to show in timeline *****************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Pub_InitializeRangeOfPubs (TL_WhatToGet_t WhatToGet, static void Tml_Pub_InitializeRangeOfPubs (Tml_WhatToGet_t WhatToGet,
struct TL_Pub_RangePubsToGet *RangePubsToGet) struct Tml_Pub_RangePubsToGet *RangePubsToGet)
{ {
/* Initialize range of pubs: /* Initialize range of pubs:
@ -223,18 +223,18 @@ static void TL_Pub_InitializeRangeOfPubs (TL_WhatToGet_t WhatToGet,
switch (WhatToGet) switch (WhatToGet)
{ {
case TL_GET_ONLY_NEW_PUBS: // Get the publications (without limit) case Tml_GET_ONLY_NEW_PUBS: // Get the publications (without limit)
// newer than LastPubCod // newer than LastPubCod
/* This query is made via AJAX automatically from time to time */ /* This query is made via AJAX automatically from time to time */
RangePubsToGet->Bottom = TL_DB_GetPubCodFromSession ("LastPubCod"); RangePubsToGet->Bottom = Tml_DB_GetPubCodFromSession ("LastPubCod");
break; break;
case TL_GET_ONLY_OLD_PUBS: // Get some limited publications case Tml_GET_ONLY_OLD_PUBS: // Get some limited publications
// older than FirstPubCod // older than FirstPubCod
/* This query is made via AJAX /* This query is made via AJAX
when I click in link to get old publications */ when I click in link to get old publications */
RangePubsToGet->Top = TL_DB_GetPubCodFromSession ("FirstPubCod"); RangePubsToGet->Top = Tml_DB_GetPubCodFromSession ("FirstPubCod");
break; break;
case TL_GET_RECENT_TIMELINE: // Get some limited recent publications case Tml_GET_RECENT_TIMELINE: // Get some limited recent publications
default: default:
/* This is the first query to get initial timeline shown /* This is the first query to get initial timeline shown
==> no notes yet in current timeline table */ ==> no notes yet in current timeline table */
@ -246,13 +246,13 @@ static void TL_Pub_InitializeRangeOfPubs (TL_WhatToGet_t WhatToGet,
/********* Get maximum number of publications to get from database ***********/ /********* Get maximum number of publications to get from database ***********/
/*****************************************************************************/ /*****************************************************************************/
static unsigned TL_Pub_GetMaxPubsToGet (const struct TL_Timeline *Timeline) static unsigned Tml_Pub_GetMaxPubsToGet (const struct Tml_Timeline *Timeline)
{ {
static const unsigned MaxPubsToGet[TL_NUM_WHAT_TO_GET] = static const unsigned MaxPubsToGet[Tml_NUM_WHAT_TO_GET] =
{ {
[TL_GET_RECENT_TIMELINE] = TL_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW, [Tml_GET_RECENT_TIMELINE] = Tml_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW,
[TL_GET_ONLY_NEW_PUBS ] = TL_Pub_MAX_NEW_PUBS_TO_GET_AND_SHOW, [Tml_GET_ONLY_NEW_PUBS ] = Tml_Pub_MAX_NEW_PUBS_TO_GET_AND_SHOW,
[TL_GET_ONLY_OLD_PUBS ] = TL_Pub_MAX_OLD_PUBS_TO_GET_AND_SHOW, [Tml_GET_ONLY_OLD_PUBS ] = Tml_Pub_MAX_OLD_PUBS_TO_GET_AND_SHOW,
}; };
return MaxPubsToGet[Timeline->WhatToGet]; return MaxPubsToGet[Timeline->WhatToGet];
@ -263,26 +263,26 @@ static unsigned TL_Pub_GetMaxPubsToGet (const struct TL_Timeline *Timeline)
/************* publication codes into session for next refresh ***************/ /************* publication codes into session for next refresh ***************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Pub_UpdateFirstLastPubCodesIntoSession (const struct TL_Timeline *Timeline) static void Tml_Pub_UpdateFirstLastPubCodesIntoSession (const struct Tml_Timeline *Timeline)
{ {
long FirstPubCod; long FirstPubCod;
switch (Timeline->WhatToGet) switch (Timeline->WhatToGet)
{ {
case TL_GET_ONLY_NEW_PUBS: // Get only new publications case Tml_GET_ONLY_NEW_PUBS: // Get only new publications
TL_DB_UpdateLastPubCodInSession (); Tml_DB_UpdateLastPubCodInSession ();
break; break;
case TL_GET_ONLY_OLD_PUBS: // Get only old publications case Tml_GET_ONLY_OLD_PUBS: // Get only old publications
// The oldest publication code retrieved and shown // The oldest publication code retrieved and shown
FirstPubCod = Timeline->Pubs.Bottom ? Timeline->Pubs.Bottom->PubCod : FirstPubCod = Timeline->Pubs.Bottom ? Timeline->Pubs.Bottom->PubCod :
0; 0;
TL_DB_UpdateFirstPubCodInSession (FirstPubCod); Tml_DB_UpdateFirstPubCodInSession (FirstPubCod);
break; break;
case TL_GET_RECENT_TIMELINE: // Get last publications case Tml_GET_RECENT_TIMELINE: // Get last publications
// The oldest publication code retrieved and shown // The oldest publication code retrieved and shown
FirstPubCod = Timeline->Pubs.Bottom ? Timeline->Pubs.Bottom->PubCod : FirstPubCod = Timeline->Pubs.Bottom ? Timeline->Pubs.Bottom->PubCod :
0; 0;
TL_DB_UpdateFirstLastPubCodsInSession (FirstPubCod); Tml_DB_UpdateFirstLastPubCodsInSession (FirstPubCod);
break; break;
} }
} }
@ -291,10 +291,10 @@ static void TL_Pub_UpdateFirstLastPubCodesIntoSession (const struct TL_Timeline
/************** Free chained list of publications in timeline ****************/ /************** Free chained list of publications in timeline ****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pub_FreeListPubs (struct TL_Timeline *Timeline) void Tml_Pub_FreeListPubs (struct Tml_Timeline *Timeline)
{ {
struct TL_Pub_Publication *Pub; struct Tml_Pub_Publication *Pub;
struct TL_Pub_Publication *Next; struct Tml_Pub_Publication *Next;
/***** Go over the list freeing memory *****/ /***** Go over the list freeing memory *****/
for (Pub = Timeline->Pubs.Top; for (Pub = Timeline->Pubs.Top;
@ -317,20 +317,20 @@ void TL_Pub_FreeListPubs (struct TL_Timeline *Timeline)
/************** Select the most recent publication from tl_pubs **************/ /************** Select the most recent publication from tl_pubs **************/
/*****************************************************************************/ /*****************************************************************************/
static struct TL_Pub_Publication *TL_Pub_SelectTheMostRecentPub (const struct TL_Pub_SubQueries *SubQueries) static struct Tml_Pub_Publication *Tml_Pub_SelectTheMostRecentPub (const struct Tml_Pub_SubQueries *SubQueries)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
struct TL_Pub_Publication *Pub; struct Tml_Pub_Publication *Pub;
/***** Select the most recent publication from database *****/ /***** Select the most recent publication from database *****/
if (TL_DB_SelectTheMostRecentPub (SubQueries,&mysql_res) == 1) if (Tml_DB_SelectTheMostRecentPub (SubQueries,&mysql_res) == 1)
{ {
/* Allocate space for publication */ /* Allocate space for publication */
if ((Pub = malloc (sizeof (*Pub))) == NULL) if ((Pub = malloc (sizeof (*Pub))) == NULL)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
/* Get data of publication */ /* Get data of publication */
TL_Pub_GetDataOfPubFromNextRow (mysql_res,Pub); Tml_Pub_GetDataOfPubFromNextRow (mysql_res,Pub);
Pub->Next = NULL; Pub->Next = NULL;
} }
else else
@ -347,10 +347,10 @@ static struct TL_Pub_Publication *TL_Pub_SelectTheMostRecentPub (const struct TL
/*****************************************************************************/ /*****************************************************************************/
// The publications are inserted as list elements of a hidden list // The publications are inserted as list elements of a hidden list
void TL_Pub_InsertNewPubsInTimeline (struct TL_Timeline *Timeline) void Tml_Pub_InsertNewPubsInTimeline (struct Tml_Timeline *Timeline)
{ {
struct TL_Pub_Publication *Pub; struct Tml_Pub_Publication *Pub;
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** List new publications in timeline *****/ /***** List new publications in timeline *****/
for (Pub = Timeline->Pubs.Top; for (Pub = Timeline->Pubs.Top;
@ -359,12 +359,12 @@ void TL_Pub_InsertNewPubsInTimeline (struct TL_Timeline *Timeline)
{ {
/* Get data of note */ /* Get data of note */
Not.NotCod = Pub->NotCod; Not.NotCod = Pub->NotCod;
TL_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
/* Write note */ /* Write note */
HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP TL_NEW_PUB\""); HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP TL_NEW_PUB\"");
TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not, Tml_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not,
TL_Pub_GetTopMessage (Pub->PubType), Tml_Pub_GetTopMessage (Pub->PubType),
Pub->PublisherCod); Pub->PublisherCod);
HTM_LI_End (); HTM_LI_End ();
} }
@ -375,10 +375,10 @@ void TL_Pub_InsertNewPubsInTimeline (struct TL_Timeline *Timeline)
/*****************************************************************************/ /*****************************************************************************/
// The publications are inserted as list elements of a hidden list // The publications are inserted as list elements of a hidden list
void TL_Pub_ShowOldPubsInTimeline (struct TL_Timeline *Timeline) void Tml_Pub_ShowOldPubsInTimeline (struct Tml_Timeline *Timeline)
{ {
struct TL_Pub_Publication *Pub; struct Tml_Pub_Publication *Pub;
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** List old publications in timeline *****/ /***** List old publications in timeline *****/
for (Pub = Timeline->Pubs.Top; for (Pub = Timeline->Pubs.Top;
@ -387,12 +387,12 @@ void TL_Pub_ShowOldPubsInTimeline (struct TL_Timeline *Timeline)
{ {
/* Get data of note */ /* Get data of note */
Not.NotCod = Pub->NotCod; Not.NotCod = Pub->NotCod;
TL_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
/* Write note */ /* Write note */
HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP\""); HTM_LI_Begin ("class=\"TL_WIDTH TL_SEP\"");
TL_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not, Tml_Not_CheckAndWriteNoteWithTopMsg (Timeline,&Not,
TL_Pub_GetTopMessage (Pub->PubType), Tml_Pub_GetTopMessage (Pub->PubType),
Pub->PublisherCod); Pub->PublisherCod);
HTM_LI_End (); HTM_LI_End ();
} }
@ -402,14 +402,14 @@ void TL_Pub_ShowOldPubsInTimeline (struct TL_Timeline *Timeline)
/************* Get a top message given the type of publication ***************/ /************* Get a top message given the type of publication ***************/
/*****************************************************************************/ /*****************************************************************************/
TL_TopMessage_t TL_Pub_GetTopMessage (TL_Pub_PubType_t PubType) Tml_TopMessage_t Tml_Pub_GetTopMessage (Tml_Pub_PubType_t PubType)
{ {
static const TL_TopMessage_t TopMessages[TL_Pub_NUM_PUB_TYPES] = static const Tml_TopMessage_t TopMessages[Tml_Pub_NUM_PUB_TYPES] =
{ {
[TL_Pub_UNKNOWN ] = TL_TOP_MESSAGE_NONE, [Tml_Pub_UNKNOWN ] = Tml_TOP_MESSAGE_NONE,
[TL_Pub_ORIGINAL_NOTE ] = TL_TOP_MESSAGE_NONE, [Tml_Pub_ORIGINAL_NOTE ] = Tml_TOP_MESSAGE_NONE,
[TL_Pub_SHARED_NOTE ] = TL_TOP_MESSAGE_SHARED, [Tml_Pub_SHARED_NOTE ] = Tml_TOP_MESSAGE_SHARED,
[TL_Pub_COMMENT_TO_NOTE] = TL_TOP_MESSAGE_COMMENTED, [Tml_Pub_COMMENT_TO_NOTE] = Tml_TOP_MESSAGE_COMMENTED,
}; };
return TopMessages[PubType]; return TopMessages[PubType];
@ -419,7 +419,7 @@ TL_TopMessage_t TL_Pub_GetTopMessage (TL_Pub_PubType_t PubType)
/***************** Put link to view new publications in timeline *************/ /***************** Put link to view new publications in timeline *************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pub_PutLinkToViewNewPubs (void) void Tml_Pub_PutLinkToViewNewPubs (void)
{ {
extern const char *The_ClassFormInBoxBold[The_NUM_THEMES]; extern const char *The_ClassFormInBoxBold[The_NUM_THEMES];
extern const char *Txt_See_new_activity; extern const char *Txt_See_new_activity;
@ -454,7 +454,7 @@ void TL_Pub_PutLinkToViewNewPubs (void)
/***************** Put link to view old publications in timeline *************/ /***************** Put link to view old publications in timeline *************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pub_PutLinkToViewOldPubs (void) void Tml_Pub_PutLinkToViewOldPubs (void)
{ {
extern const char *The_ClassFormInBoxBold[The_NUM_THEMES]; extern const char *The_ClassFormInBoxBold[The_NUM_THEMES];
extern const char *Txt_See_more; extern const char *Txt_See_more;
@ -492,7 +492,7 @@ void TL_Pub_PutLinkToViewOldPubs (void)
/*************** Put parameter with the code of a publication ****************/ /*************** Put parameter with the code of a publication ****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pub_PutHiddenParamPubCod (long PubCod) void Tml_Pub_PutHiddenParamPubCod (long PubCod)
{ {
Par_PutHiddenParamLong (NULL,"PubCod",PubCod); Par_PutHiddenParamLong (NULL,"PubCod",PubCod);
} }
@ -501,7 +501,7 @@ void TL_Pub_PutHiddenParamPubCod (long PubCod)
/**************** Get parameter with the code of a publication ***************/ /**************** Get parameter with the code of a publication ***************/
/*****************************************************************************/ /*****************************************************************************/
long TL_Pub_GetParamPubCod (void) long Tml_Pub_GetParamPubCod (void)
{ {
/***** Get comment code *****/ /***** Get comment code *****/
return Par_GetParToLong ("PubCod"); return Par_GetParToLong ("PubCod");
@ -511,8 +511,8 @@ long TL_Pub_GetParamPubCod (void)
/***************** Get data of publication using its code ********************/ /***************** Get data of publication using its code ********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pub_GetDataOfPubFromNextRow (MYSQL_RES *mysql_res, void Tml_Pub_GetDataOfPubFromNextRow (MYSQL_RES *mysql_res,
struct TL_Pub_Publication *Pub) struct Tml_Pub_Publication *Pub)
{ {
MYSQL_ROW row; MYSQL_ROW row;
@ -529,23 +529,23 @@ void TL_Pub_GetDataOfPubFromNextRow (MYSQL_RES *mysql_res,
Pub->PubCod = Str_ConvertStrCodToLongCod (row[0]); Pub->PubCod = Str_ConvertStrCodToLongCod (row[0]);
Pub->NotCod = Str_ConvertStrCodToLongCod (row[1]); Pub->NotCod = Str_ConvertStrCodToLongCod (row[1]);
Pub->PublisherCod = Str_ConvertStrCodToLongCod (row[2]); Pub->PublisherCod = Str_ConvertStrCodToLongCod (row[2]);
Pub->PubType = TL_Pub_GetPubTypeFromStr (row[3]); Pub->PubType = Tml_Pub_GetPubTypeFromStr (row[3]);
} }
/*****************************************************************************/ /*****************************************************************************/
/******* Get publication type from string number coming from database ********/ /******* Get publication type from string number coming from database ********/
/*****************************************************************************/ /*****************************************************************************/
static TL_Pub_PubType_t TL_Pub_GetPubTypeFromStr (const char *Str) static Tml_Pub_PubType_t Tml_Pub_GetPubTypeFromStr (const char *Str)
{ {
unsigned UnsignedNum; unsigned UnsignedNum;
/***** Get publication type from string *****/ /***** Get publication type from string *****/
if (sscanf (Str,"%u",&UnsignedNum) == 1) if (sscanf (Str,"%u",&UnsignedNum) == 1)
if (UnsignedNum < TL_Pub_NUM_PUB_TYPES) if (UnsignedNum < Tml_Pub_NUM_PUB_TYPES)
return (TL_Pub_PubType_t) UnsignedNum; return (Tml_Pub_PubType_t) UnsignedNum;
return TL_Pub_UNKNOWN; return Tml_Pub_UNKNOWN;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -553,10 +553,10 @@ static TL_Pub_PubType_t TL_Pub_GetPubTypeFromStr (const char *Str)
/*****************************************************************************/ /*****************************************************************************/
// Pub->PubCod is set by the function // Pub->PubCod is set by the function
void TL_Pub_PublishPubInTimeline (struct TL_Pub_Publication *Pub) void Tml_Pub_PublishPubInTimeline (struct Tml_Pub_Publication *Pub)
{ {
/***** Publish note in timeline *****/ /***** Publish note in timeline *****/
Pub->PubCod = TL_DB_CreateNewPub (Pub); Pub->PubCod = Tml_DB_CreateNewPub (Pub);
/***** Increment number of publications in user's figures *****/ /***** Increment number of publications in user's figures *****/
Prf_IncrementNumPubsUsr (Pub->PublisherCod); Prf_IncrementNumPubsUsr (Pub->PublisherCod);

View File

@ -1,7 +1,7 @@
// swad_timeline_publication.h: social timeline publications // swad_timeline_publication.h: social timeline publications
#ifndef _SWAD_TL_PUB #ifndef _SWAD_TML_PUB
#define _SWAD_TL_PUB #define _SWAD_TML_PUB
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -37,71 +37,71 @@
/*****************************************************************************/ /*****************************************************************************/
// Number of recent publishings got and shown the first time, before refreshing // Number of recent publishings got and shown the first time, before refreshing
#define TL_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW 10 // Recent publishings to show (first time) #define Tml_Pub_MAX_REC_PUBS_TO_GET_AND_SHOW 10 // Recent publishings to show (first time)
#define TL_Pub_MAX_NEW_PUBS_TO_GET_AND_SHOW 10000 // New publishings retrieved (big number) #define Tml_Pub_MAX_NEW_PUBS_TO_GET_AND_SHOW 10000 // New publishings retrieved (big number)
#define TL_Pub_MAX_OLD_PUBS_TO_GET_AND_SHOW 20 // Old publishings are retrieved in packs of this size #define Tml_Pub_MAX_OLD_PUBS_TO_GET_AND_SHOW 20 // Old publishings are retrieved in packs of this size
/*****************************************************************************/ /*****************************************************************************/
/******************************** Public types *******************************/ /******************************** Public types *******************************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_Pub_NUM_PUB_TYPES 4 #define Tml_Pub_NUM_PUB_TYPES 4
// If the numbers assigned to each event type change, // If the numbers assigned to each event type change,
// it is necessary to change old numbers to new ones in database table tl_notes // it is necessary to change old numbers to new ones in database table tl_notes
typedef enum typedef enum
{ {
TL_Pub_UNKNOWN = 0, Tml_Pub_UNKNOWN = 0,
TL_Pub_ORIGINAL_NOTE = 1, Tml_Pub_ORIGINAL_NOTE = 1,
TL_Pub_SHARED_NOTE = 2, Tml_Pub_SHARED_NOTE = 2,
TL_Pub_COMMENT_TO_NOTE = 3, Tml_Pub_COMMENT_TO_NOTE = 3,
} TL_Pub_PubType_t; } Tml_Pub_PubType_t;
struct TL_Pub_Publication struct Tml_Pub_Publication
{ {
long PubCod; long PubCod;
long NotCod; long NotCod;
long PublisherCod; // Sharer or writer of the publication long PublisherCod; // Sharer or writer of the publication
TL_Pub_PubType_t PubType; Tml_Pub_PubType_t PubType;
struct TL_Pub_Publication *Next; // Used for chained list struct Tml_Pub_Publication *Next; // Used for chained list
}; };
struct TL_Pub_RangePubsToGet struct Tml_Pub_RangePubsToGet
{ {
long Top; long Top;
long Bottom; long Bottom;
}; };
#define TL_Pub_MAX_BYTES_SUBQUERY (128 - 1) #define Tml_Pub_MAX_BYTES_SUBQUERY (128 - 1)
struct TL_Pub_SubQueries struct Tml_Pub_SubQueries
{ {
char *TablePublishers; char *TablePublishers;
char Publishers [TL_Pub_MAX_BYTES_SUBQUERY + 1]; char Publishers [Tml_Pub_MAX_BYTES_SUBQUERY + 1];
char RangeBottom [TL_Pub_MAX_BYTES_SUBQUERY + 1]; char RangeBottom [Tml_Pub_MAX_BYTES_SUBQUERY + 1];
char RangeTop [TL_Pub_MAX_BYTES_SUBQUERY + 1]; char RangeTop [Tml_Pub_MAX_BYTES_SUBQUERY + 1];
char AlreadyExists[TL_Pub_MAX_BYTES_SUBQUERY + 1]; char AlreadyExists[Tml_Pub_MAX_BYTES_SUBQUERY + 1];
}; };
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Pub_GetListPubsToShowInTimeline (struct TL_Timeline *Timeline); void Tml_Pub_GetListPubsToShowInTimeline (struct Tml_Timeline *Timeline);
void TL_Pub_FreeListPubs (struct TL_Timeline *Timeline); void Tml_Pub_FreeListPubs (struct Tml_Timeline *Timeline);
void TL_Pub_InsertNewPubsInTimeline (struct TL_Timeline *Timeline); void Tml_Pub_InsertNewPubsInTimeline (struct Tml_Timeline *Timeline);
void TL_Pub_ShowOldPubsInTimeline (struct TL_Timeline *Timeline); void Tml_Pub_ShowOldPubsInTimeline (struct Tml_Timeline *Timeline);
TL_TopMessage_t TL_Pub_GetTopMessage (TL_Pub_PubType_t PubType); Tml_TopMessage_t Tml_Pub_GetTopMessage (Tml_Pub_PubType_t PubType);
void TL_Pub_PutLinkToViewNewPubs (void); void Tml_Pub_PutLinkToViewNewPubs (void);
void TL_Pub_PutLinkToViewOldPubs (void); void Tml_Pub_PutLinkToViewOldPubs (void);
void TL_Pub_PutHiddenParamPubCod (long PubCod); void Tml_Pub_PutHiddenParamPubCod (long PubCod);
long TL_Pub_GetParamPubCod (void); long Tml_Pub_GetParamPubCod (void);
void TL_Pub_GetDataOfPubFromNextRow (MYSQL_RES *mysql_res, void Tml_Pub_GetDataOfPubFromNextRow (MYSQL_RES *mysql_res,
struct TL_Pub_Publication *Pub); struct Tml_Pub_Publication *Pub);
void TL_Pub_PublishPubInTimeline (struct TL_Pub_Publication *Pub); void Tml_Pub_PublishPubInTimeline (struct Tml_Pub_Publication *Pub);
#endif #endif

View File

@ -55,142 +55,142 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Sha_ShaNote (struct TL_Not_Note *Not); static void Tml_Sha_ShaNote (struct Tml_Not_Note *Not);
static void TL_Sha_UnsNote (struct TL_Not_Note *Not); static void Tml_Sha_UnsNote (struct Tml_Not_Note *Not);
/*****************************************************************************/ /*****************************************************************************/
/****************************** Show all sharers *****************************/ /****************************** Show all sharers *****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Sha_ShowAllSharersNoteUsr (void) void Tml_Sha_ShowAllSharersNoteUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Show all sharers *****/ /***** Show all sharers *****/
TL_Sha_ShowAllSharersNoteGbl (); Tml_Sha_ShowAllSharersNoteGbl ();
} }
void TL_Sha_ShowAllSharersNoteGbl (void) void Tml_Sha_ShowAllSharersNoteGbl (void)
{ {
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Get data of note *****/ /***** Get data of note *****/
Not.NotCod = TL_Not_GetParamNotCod (); Not.NotCod = Tml_Not_GetParamNotCod ();
TL_Not_GetDataOfNoteByCod (&Not); Tml_Not_GetDataOfNoteByCod (&Not);
/***** Write HTML inside DIV with form to share/unshare *****/ /***** Write HTML inside DIV with form to share/unshare *****/
TL_Usr_PutIconFavSha (TL_Usr_SHA_UNS_NOTE, Tml_Usr_PutIconFavSha (Tml_Usr_SHA_UNS_NOTE,
Not.NotCod,Not.UsrCod,Not.NumShared, Not.NotCod,Not.UsrCod,Not.NumShared,
TL_Usr_SHOW_ALL_USRS); Tml_Usr_SHOW_ALL_USRS);
} }
/*****************************************************************************/ /*****************************************************************************/
/******************************** Share a note *******************************/ /******************************** Share a note *******************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Sha_ShaNoteUsr (void) void Tml_Sha_ShaNoteUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Share note *****/ /***** Share note *****/
TL_Sha_ShaNoteGbl (); Tml_Sha_ShaNoteGbl ();
} }
void TL_Sha_ShaNoteGbl (void) void Tml_Sha_ShaNoteGbl (void)
{ {
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Share note *****/ /***** Share note *****/
TL_Sha_ShaNote (&Not); Tml_Sha_ShaNote (&Not);
/***** Write HTML inside DIV with form to unshare *****/ /***** Write HTML inside DIV with form to unshare *****/
TL_Usr_PutIconFavSha (TL_Usr_SHA_UNS_NOTE, Tml_Usr_PutIconFavSha (Tml_Usr_SHA_UNS_NOTE,
Not.NotCod,Not.UsrCod,Not.NumShared, Not.NotCod,Not.UsrCod,Not.NumShared,
TL_Usr_SHOW_FEW_USRS); Tml_Usr_SHOW_FEW_USRS);
} }
static void TL_Sha_ShaNote (struct TL_Not_Note *Not) static void Tml_Sha_ShaNote (struct Tml_Not_Note *Not)
{ {
struct TL_Pub_Publication Pub; struct Tml_Pub_Publication Pub;
long OriginalPubCod; long OriginalPubCod;
/***** Get data of note *****/ /***** Get data of note *****/
Not->NotCod = TL_Not_GetParamNotCod (); Not->NotCod = Tml_Not_GetParamNotCod ();
TL_Not_GetDataOfNoteByCod (Not); Tml_Not_GetDataOfNoteByCod (Not);
/***** Do some checks *****/ /***** Do some checks *****/
if (!TL_Usr_CheckIfICanFavSha (Not->NotCod,Not->UsrCod)) if (!Tml_Usr_CheckIfICanFavSha (Not->NotCod,Not->UsrCod))
return; return;
/***** Trivial check: Is note already shared by me? *****/ /***** Trivial check: Is note already shared by me? *****/
if (TL_Usr_CheckIfFavedSharedByUsr (TL_Usr_SHA_UNS_NOTE,Not->NotCod, if (Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_SHA_UNS_NOTE,Not->NotCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) Gbl.Usrs.Me.UsrDat.UsrCod))
return; return;
/***** Share (publish note in timeline) *****/ /***** Share (publish note in timeline) *****/
Pub.NotCod = Not->NotCod; Pub.NotCod = Not->NotCod;
Pub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod; Pub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
Pub.PubType = TL_Pub_SHARED_NOTE; Pub.PubType = Tml_Pub_SHARED_NOTE;
TL_Pub_PublishPubInTimeline (&Pub); // Set Pub.PubCod Tml_Pub_PublishPubInTimeline (&Pub); // Set Pub.PubCod
/***** Update number of times this note is shared *****/ /***** Update number of times this note is shared *****/
Not->NumShared = TL_DB_GetNumSharers (Not->NotCod,Not->UsrCod); Not->NumShared = Tml_DB_GetNumSharers (Not->NotCod,Not->UsrCod);
/***** Create notification about shared post /***** Create notification about shared post
for the author of the post *****/ for the author of the post *****/
OriginalPubCod = TL_DB_GetPubCodOfOriginalNote (Not->NotCod); OriginalPubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod);
if (OriginalPubCod > 0) if (OriginalPubCod > 0)
TL_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod,Ntf_EVENT_TL_SHARE); Tml_Ntf_CreateNotifToAuthor (Not->UsrCod,OriginalPubCod,Ntf_EVENT_TL_SHARE);
} }
/*****************************************************************************/ /*****************************************************************************/
/******************** Unshare a previously shared note ***********************/ /******************** Unshare a previously shared note ***********************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Sha_UnsNoteUsr (void) void Tml_Sha_UnsNoteUsr (void)
{ {
/***** Get user whom profile is displayed *****/ /***** Get user whom profile is displayed *****/
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (); Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
/***** Unshare note *****/ /***** Unshare note *****/
TL_Sha_UnsNoteGbl (); Tml_Sha_UnsNoteGbl ();
} }
void TL_Sha_UnsNoteGbl (void) void Tml_Sha_UnsNoteGbl (void)
{ {
struct TL_Not_Note Not; struct Tml_Not_Note Not;
/***** Unshare note *****/ /***** Unshare note *****/
TL_Sha_UnsNote (&Not); Tml_Sha_UnsNote (&Not);
/***** Write HTML inside DIV with form to share *****/ /***** Write HTML inside DIV with form to share *****/
TL_Usr_PutIconFavSha (TL_Usr_SHA_UNS_NOTE, Tml_Usr_PutIconFavSha (Tml_Usr_SHA_UNS_NOTE,
Not.NotCod,Not.UsrCod,Not.NumShared, Not.NotCod,Not.UsrCod,Not.NumShared,
TL_Usr_SHOW_FEW_USRS); Tml_Usr_SHOW_FEW_USRS);
} }
static void TL_Sha_UnsNote (struct TL_Not_Note *Not) static void Tml_Sha_UnsNote (struct Tml_Not_Note *Not)
{ {
long OriginalPubCod; long OriginalPubCod;
/***** Get data of note *****/ /***** Get data of note *****/
Not->NotCod = TL_Not_GetParamNotCod (); Not->NotCod = Tml_Not_GetParamNotCod ();
TL_Not_GetDataOfNoteByCod (Not); Tml_Not_GetDataOfNoteByCod (Not);
/***** Do some checks *****/ /***** Do some checks *****/
if (!TL_Usr_CheckIfICanFavSha (Not->NotCod,Not->UsrCod)) if (!Tml_Usr_CheckIfICanFavSha (Not->NotCod,Not->UsrCod))
return; return;
/***** Delete publication from database *****/ /***** Delete publication from database *****/
TL_DB_RemoveSharedPub (Not->NotCod); Tml_DB_RemoveSharedPub (Not->NotCod);
/***** Update number of times this note is shared *****/ /***** Update number of times this note is shared *****/
Not->NumShared = TL_DB_GetNumSharers (Not->NotCod,Not->UsrCod); Not->NumShared = Tml_DB_GetNumSharers (Not->NotCod,Not->UsrCod);
/***** Mark possible notifications on this note as removed *****/ /***** Mark possible notifications on this note as removed *****/
OriginalPubCod = TL_DB_GetPubCodOfOriginalNote (Not->NotCod); OriginalPubCod = Tml_DB_GetPubCodOfOriginalNote (Not->NotCod);
if (OriginalPubCod > 0) if (OriginalPubCod > 0)
Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_SHARE,OriginalPubCod); Ntf_MarkNotifAsRemoved (Ntf_EVENT_TL_SHARE,OriginalPubCod);
} }

View File

@ -1,7 +1,7 @@
// swad_timeline_share.h: social timeline shared // swad_timeline_share.h: social timeline shared
#ifndef _SWAD_TL_SHA #ifndef _SWAD_TML_SHA
#define _SWAD_TL_SHA #define _SWAD_TML_SHA
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -31,8 +31,8 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_Sha_ICON_SHARE "share-alt.svg" #define Tml_Sha_ICON_SHARE "share-alt.svg"
#define TL_Sha_ICON_SHARED "share-alt-green.svg" #define Tml_Sha_ICON_SHARED "share-alt-green.svg"
/*****************************************************************************/ /*****************************************************************************/
/******************************** Public types *******************************/ /******************************** Public types *******************************/
@ -42,11 +42,11 @@
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Sha_ShowAllSharersNoteUsr (void); void Tml_Sha_ShowAllSharersNoteUsr (void);
void TL_Sha_ShowAllSharersNoteGbl (void); void Tml_Sha_ShowAllSharersNoteGbl (void);
void TL_Sha_ShaNoteUsr (void); void Tml_Sha_ShaNoteUsr (void);
void TL_Sha_ShaNoteGbl (void); void Tml_Sha_ShaNoteGbl (void);
void TL_Sha_UnsNoteUsr (void); void Tml_Sha_UnsNoteUsr (void);
void TL_Sha_UnsNoteGbl (void); void Tml_Sha_UnsNoteGbl (void);
#endif #endif

View File

@ -61,86 +61,86 @@ extern struct Globals Gbl;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Usr_GetAndShowSharersOrFavers (TL_Usr_FavSha_t FavSha, static void Tml_Usr_GetAndShowSharersOrFavers (Tml_Usr_FavSha_t FavSha,
long Cod,long UsrCod,unsigned NumUsrs, long Cod,long UsrCod,unsigned NumUsrs,
TL_Usr_HowManyUsrs_t HowManyUsrs); Tml_Usr_HowManyUsrs_t HowManyUsrs);
static void TL_Usr_ShowNumSharersOrFavers (unsigned NumUsrs); static void Tml_Usr_ShowNumSharersOrFavers (unsigned NumUsrs);
static void TL_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res, static void Tml_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res,
unsigned NumUsrs,unsigned NumFirstUsrs); unsigned NumUsrs,unsigned NumFirstUsrs);
static unsigned TL_Usr_GetListFaversOrSharers (TL_Usr_FavSha_t FavSha, static unsigned Tml_Usr_GetListFaversOrSharers (Tml_Usr_FavSha_t FavSha,
long Cod,long UsrCod,unsigned MaxUsrs, long Cod,long UsrCod,unsigned MaxUsrs,
MYSQL_RES **mysql_res); MYSQL_RES **mysql_res);
static void TL_Usr_PutDisabledIconFavSha (TL_Usr_FavSha_t FavSha, static void Tml_Usr_PutDisabledIconFavSha (Tml_Usr_FavSha_t FavSha,
unsigned NumUsrs); unsigned NumUsrs);
/*****************************************************************************/ /*****************************************************************************/
/************* Remove all the content of a user from database ****************/ /************* Remove all the content of a user from database ****************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Usr_RemoveUsrContent (long UsrCod) void Tml_Usr_RemoveUsrContent (long UsrCod)
{ {
/***** Remove favs for comments *****/ /***** Remove favs for comments *****/
/* Remove all favs made by this user to any comment */ /* Remove all favs made by this user to any comment */
TL_DB_RemoveAllFavsMadeByUsr (TL_Usr_FAV_UNF_COMM,UsrCod); Tml_DB_RemoveAllFavsMadeByUsr (Tml_Usr_FAV_UNF_COMM,UsrCod);
/* Remove all favs to comments of this user */ /* Remove all favs to comments of this user */
TL_DB_RemoveAllFavsToPubsBy (TL_Usr_FAV_UNF_COMM,UsrCod); Tml_DB_RemoveAllFavsToPubsBy (Tml_Usr_FAV_UNF_COMM,UsrCod);
/* Remove all favs to all comments in all notes authored by this user */ /* Remove all favs to all comments in all notes authored by this user */
TL_DB_RemoveAllFavsToAllCommsInAllNotesBy (UsrCod); Tml_DB_RemoveAllFavsToAllCommsInAllNotesBy (UsrCod);
/***** Remove favs for notes *****/ /***** Remove favs for notes *****/
/* Remove all favs made by this user to any note */ /* Remove all favs made by this user to any note */
TL_DB_RemoveAllFavsMadeByUsr (TL_Usr_FAV_UNF_NOTE,UsrCod); Tml_DB_RemoveAllFavsMadeByUsr (Tml_Usr_FAV_UNF_NOTE,UsrCod);
/* Remove all favs to notes of this user */ /* Remove all favs to notes of this user */
TL_DB_RemoveAllFavsToPubsBy (TL_Usr_FAV_UNF_NOTE,UsrCod); Tml_DB_RemoveAllFavsToPubsBy (Tml_Usr_FAV_UNF_NOTE,UsrCod);
/***** Remove comments *****/ /***** Remove comments *****/
/* Remove all comments in all the notes of this user */ /* Remove all comments in all the notes of this user */
TL_DB_RemoveAllCommsInAllNotesOf (UsrCod); Tml_DB_RemoveAllCommsInAllNotesOf (UsrCod);
/* Remove all comments made by this user in any note */ /* Remove all comments made by this user in any note */
TL_DB_RemoveAllCommsMadeBy (UsrCod); Tml_DB_RemoveAllCommsMadeBy (UsrCod);
/***** Remove posts *****/ /***** Remove posts *****/
/* Remove all posts of the user */ /* Remove all posts of the user */
TL_DB_RemoveAllPostsUsr (UsrCod); Tml_DB_RemoveAllPostsUsr (UsrCod);
/***** Remove publications *****/ /***** Remove publications *****/
/* Remove all publications (original, shared notes, comments) /* Remove all publications (original, shared notes, comments)
published by any user published by any user
and related to notes authored by the user */ and related to notes authored by the user */
TL_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (UsrCod); Tml_DB_RemoveAllPubsPublishedByAnyUsrOfNotesAuthoredBy (UsrCod);
/* Remove all publications published by the user */ /* Remove all publications published by the user */
TL_DB_RemoveAllPubsPublishedBy (UsrCod); Tml_DB_RemoveAllPubsPublishedBy (UsrCod);
/***** Remove notes *****/ /***** Remove notes *****/
/* Remove all notes of the user */ /* Remove all notes of the user */
TL_DB_RemoveAllNotesUsr (UsrCod); Tml_DB_RemoveAllNotesUsr (UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/
/************** Show users who have faved/shared a note/comment **************/ /************** Show users who have faved/shared a note/comment **************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Usr_GetAndShowSharersOrFavers (TL_Usr_FavSha_t FavSha, static void Tml_Usr_GetAndShowSharersOrFavers (Tml_Usr_FavSha_t FavSha,
long Cod,long UsrCod,unsigned NumUsrs, long Cod,long UsrCod,unsigned NumUsrs,
TL_Usr_HowManyUsrs_t HowManyUsrs) Tml_Usr_HowManyUsrs_t HowManyUsrs)
{ {
static const TL_Frm_Action_t Action[TL_Usr_NUM_FAV_SHA] = static const Tml_Frm_Action_t Action[Tml_Usr_NUM_FAV_SHA] =
{ {
[TL_Usr_FAV_UNF_NOTE] = TL_Frm_ALL_FAV_NOTE, [Tml_Usr_FAV_UNF_NOTE] = Tml_Frm_ALL_FAV_NOTE,
[TL_Usr_FAV_UNF_COMM] = TL_Frm_ALL_FAV_COMM, [Tml_Usr_FAV_UNF_COMM] = Tml_Frm_ALL_FAV_COMM,
[TL_Usr_SHA_UNS_NOTE] = TL_Frm_ALL_SHA_NOTE, [Tml_Usr_SHA_UNS_NOTE] = Tml_Frm_ALL_SHA_NOTE,
}; };
static const char *ParamFormat[TL_Usr_NUM_FAV_SHA] = static const char *ParamFormat[Tml_Usr_NUM_FAV_SHA] =
{ {
[TL_Usr_FAV_UNF_NOTE] = "NotCod=%ld", [Tml_Usr_FAV_UNF_NOTE] = "NotCod=%ld",
[TL_Usr_FAV_UNF_COMM] = "PubCod=%ld", [Tml_Usr_FAV_UNF_COMM] = "PubCod=%ld",
[TL_Usr_SHA_UNS_NOTE] = "NotCod=%ld", [Tml_Usr_SHA_UNS_NOTE] = "NotCod=%ld",
}; };
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
unsigned NumFirstUsrs; unsigned NumFirstUsrs;
@ -148,25 +148,25 @@ static void TL_Usr_GetAndShowSharersOrFavers (TL_Usr_FavSha_t FavSha,
/***** Get users who have faved/shared *****/ /***** Get users who have faved/shared *****/
if (NumUsrs) if (NumUsrs)
NumFirstUsrs = NumFirstUsrs =
TL_Usr_GetListFaversOrSharers (FavSha,Cod,UsrCod, Tml_Usr_GetListFaversOrSharers (FavSha,Cod,UsrCod,
HowManyUsrs == TL_Usr_SHOW_FEW_USRS ? TL_Usr_DEF_USRS_SHOWN : HowManyUsrs == Tml_Usr_SHOW_FEW_USRS ? Tml_Usr_DEF_USRS_SHOWN :
TL_Usr_MAX_USRS_SHOWN, Tml_Usr_MAX_USRS_SHOWN,
&mysql_res); &mysql_res);
else else
NumFirstUsrs = 0; NumFirstUsrs = 0;
/***** Show users *****/ /***** Show users *****/
/* Number of users */ /* Number of users */
HTM_DIV_Begin ("class=\"TL_NUM_USRS\""); HTM_DIV_Begin ("class=\"Tml_NUM_USRS\"");
TL_Usr_ShowNumSharersOrFavers (NumUsrs); Tml_Usr_ShowNumSharersOrFavers (NumUsrs);
HTM_DIV_End (); HTM_DIV_End ();
/* List users one by one */ /* List users one by one */
HTM_DIV_Begin ("class=\"TL_USRS\""); HTM_DIV_Begin ("class=\"TL_USRS\"");
TL_Usr_ListSharersOrFavers (&mysql_res,NumUsrs,NumFirstUsrs); Tml_Usr_ListSharersOrFavers (&mysql_res,NumUsrs,NumFirstUsrs);
if (NumFirstUsrs < NumUsrs) // Not all are shown if (NumFirstUsrs < NumUsrs) // Not all are shown
/* Clickable ellipsis to show all users */ /* Clickable ellipsis to show all users */
TL_Frm_PutFormToSeeAllFaversSharers (Action[FavSha], Tml_Frm_PutFormToSeeAllFaversSharers (Action[FavSha],
ParamFormat[FavSha],Cod, ParamFormat[FavSha],Cod,
HowManyUsrs); HowManyUsrs);
HTM_DIV_End (); HTM_DIV_End ();
@ -180,15 +180,15 @@ static void TL_Usr_GetAndShowSharersOrFavers (TL_Usr_FavSha_t FavSha,
/************************ Show sharers or favouriters ************************/ /************************ Show sharers or favouriters ************************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Usr_ShowNumSharersOrFavers (unsigned NumUsrs) static void Tml_Usr_ShowNumSharersOrFavers (unsigned NumUsrs)
{ {
/***** Show number of sharers or favers /***** Show number of sharers or favers
(users who have shared or marked this note as favourite) *****/ (users who have shared or marked this note as favourite) *****/
HTM_TxtF ("&nbsp;%u",NumUsrs); HTM_TxtF ("&nbsp;%u",NumUsrs);
} }
static void TL_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res, static void Tml_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res,
unsigned NumUsrs,unsigned NumFirstUsrs) unsigned NumUsrs,unsigned NumFirstUsrs)
{ {
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumUsr; unsigned NumUsr;
@ -236,15 +236,15 @@ static void TL_Usr_ListSharersOrFavers (MYSQL_RES **mysql_res,
/************* Check if a user has faved/shared a note/comment ***************/ /************* Check if a user has faved/shared a note/comment ***************/
/*****************************************************************************/ /*****************************************************************************/
bool TL_Usr_CheckIfFavedSharedByUsr (TL_Usr_FavSha_t FavSha,long Cod,long UsrCod) bool Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FavSha_t FavSha,long Cod,long UsrCod)
{ {
switch (FavSha) switch (FavSha)
{ {
case TL_Usr_FAV_UNF_NOTE: case Tml_Usr_FAV_UNF_NOTE:
case TL_Usr_FAV_UNF_COMM: case Tml_Usr_FAV_UNF_COMM:
return TL_DB_CheckIfFavedByUsr (FavSha,Cod,UsrCod); return Tml_DB_CheckIfFavedByUsr (FavSha,Cod,UsrCod);
case TL_Usr_SHA_UNS_NOTE: case Tml_Usr_SHA_UNS_NOTE:
return TL_DB_CheckIfSharedByUsr (Cod,UsrCod); return Tml_DB_CheckIfSharedByUsr (Cod,UsrCod);
default: default:
Lay_ShowErrorAndExit ("Wrong fav/share action."); Lay_ShowErrorAndExit ("Wrong fav/share action.");
} }
@ -256,17 +256,17 @@ bool TL_Usr_CheckIfFavedSharedByUsr (TL_Usr_FavSha_t FavSha,long Cod,long UsrCod
/******* Get list of users who have marked a note/comment as favourite *******/ /******* Get list of users who have marked a note/comment as favourite *******/
/*****************************************************************************/ /*****************************************************************************/
static unsigned TL_Usr_GetListFaversOrSharers (TL_Usr_FavSha_t FavSha, static unsigned Tml_Usr_GetListFaversOrSharers (Tml_Usr_FavSha_t FavSha,
long Cod,long UsrCod,unsigned MaxUsrs, long Cod,long UsrCod,unsigned MaxUsrs,
MYSQL_RES **mysql_res) MYSQL_RES **mysql_res)
{ {
switch (FavSha) switch (FavSha)
{ {
case TL_Usr_FAV_UNF_NOTE: case Tml_Usr_FAV_UNF_NOTE:
case TL_Usr_FAV_UNF_COMM: case Tml_Usr_FAV_UNF_COMM:
return TL_DB_GetFavers (FavSha,Cod,UsrCod,MaxUsrs,mysql_res); return Tml_DB_GetFavers (FavSha,Cod,UsrCod,MaxUsrs,mysql_res);
case TL_Usr_SHA_UNS_NOTE: case Tml_Usr_SHA_UNS_NOTE:
return TL_DB_GetSharers (Cod,UsrCod,MaxUsrs,mysql_res); return Tml_DB_GetSharers (Cod,UsrCod,MaxUsrs,mysql_res);
default: default:
Lay_ShowErrorAndExit ("Wrong fav/share action."); Lay_ShowErrorAndExit ("Wrong fav/share action.");
} }
@ -278,9 +278,9 @@ static unsigned TL_Usr_GetListFaversOrSharers (TL_Usr_FavSha_t FavSha,
/**************** Put icon to fav/unfav and list of favers *******************/ /**************** Put icon to fav/unfav and list of favers *******************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Usr_PutIconFavSha (TL_Usr_FavSha_t FavSha, void Tml_Usr_PutIconFavSha (Tml_Usr_FavSha_t FavSha,
long Cod,long UsrCod,unsigned NumUsrs, long Cod,long UsrCod,unsigned NumUsrs,
TL_Usr_HowManyUsrs_t HowManyUsrs) Tml_Usr_HowManyUsrs_t HowManyUsrs)
{ {
/***** Put form to fav/unfav or share/unshare this note/comment *****/ /***** Put form to fav/unfav or share/unshare this note/comment *****/
/* Begin container */ /* Begin container */
@ -288,45 +288,45 @@ void TL_Usr_PutIconFavSha (TL_Usr_FavSha_t FavSha,
/* Icon to fav/unfav or share/unshare this note/comment */ /* Icon to fav/unfav or share/unshare this note/comment */
if (Usr_ItsMe (UsrCod)) // I am the author ==> I can not fav/unfav or share/unshare if (Usr_ItsMe (UsrCod)) // I am the author ==> I can not fav/unfav or share/unshare
TL_Usr_PutDisabledIconFavSha (FavSha,NumUsrs); Tml_Usr_PutDisabledIconFavSha (FavSha,NumUsrs);
else // I am not the author else // I am not the author
TL_Frm_PutFormToFavUnfShaUns (FavSha,Cod); Tml_Frm_PutFormToFavUnfShaUns (FavSha,Cod);
/* End container */ /* End container */
HTM_DIV_End (); HTM_DIV_End ();
/***** Show who have faved/shared this note/comment *****/ /***** Show who have faved/shared this note/comment *****/
TL_Usr_GetAndShowSharersOrFavers (FavSha,Cod,UsrCod,NumUsrs,HowManyUsrs); Tml_Usr_GetAndShowSharersOrFavers (FavSha,Cod,UsrCod,NumUsrs,HowManyUsrs);
} }
/*****************************************************************************/ /*****************************************************************************/
/****************** Put disabled icon to mark as favourite *******************/ /****************** Put disabled icon to mark as favourite *******************/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Usr_PutDisabledIconFavSha (TL_Usr_FavSha_t FavSha, static void Tml_Usr_PutDisabledIconFavSha (Tml_Usr_FavSha_t FavSha,
unsigned NumUsrs) unsigned NumUsrs)
{ {
extern const char *Txt_TIMELINE_Favourited_by_X_USERS; extern const char *Txt_TIMELINE_Favourited_by_X_USERS;
extern const char *Txt_TIMELINE_Not_favourited_by_anyone; extern const char *Txt_TIMELINE_Not_favourited_by_anyone;
extern const char *Txt_TIMELINE_Shared_by_X_USERS; extern const char *Txt_TIMELINE_Shared_by_X_USERS;
extern const char *Txt_TIMELINE_Not_shared_by_anyone; extern const char *Txt_TIMELINE_Not_shared_by_anyone;
static const char *Icon[TL_Usr_NUM_FAV_SHA] = static const char *Icon[Tml_Usr_NUM_FAV_SHA] =
{ {
[TL_Usr_FAV_UNF_NOTE] = TL_Fav_ICON_FAV, [Tml_Usr_FAV_UNF_NOTE] = Tml_Fav_ICON_FAV,
[TL_Usr_FAV_UNF_COMM] = TL_Fav_ICON_FAV, [Tml_Usr_FAV_UNF_COMM] = Tml_Fav_ICON_FAV,
[TL_Usr_SHA_UNS_NOTE] = TL_Sha_ICON_SHARE, [Tml_Usr_SHA_UNS_NOTE] = Tml_Sha_ICON_SHARE,
}; };
const char *TitleWithUsrs[TL_Usr_NUM_FAV_SHA] = const char *TitleWithUsrs[Tml_Usr_NUM_FAV_SHA] =
{ {
[TL_Usr_FAV_UNF_NOTE] = Txt_TIMELINE_Favourited_by_X_USERS, [Tml_Usr_FAV_UNF_NOTE] = Txt_TIMELINE_Favourited_by_X_USERS,
[TL_Usr_FAV_UNF_COMM] = Txt_TIMELINE_Favourited_by_X_USERS, [Tml_Usr_FAV_UNF_COMM] = Txt_TIMELINE_Favourited_by_X_USERS,
[TL_Usr_SHA_UNS_NOTE] = Txt_TIMELINE_Shared_by_X_USERS, [Tml_Usr_SHA_UNS_NOTE] = Txt_TIMELINE_Shared_by_X_USERS,
}; };
const char *TitleWithoutUsrs[TL_Usr_NUM_FAV_SHA] = const char *TitleWithoutUsrs[Tml_Usr_NUM_FAV_SHA] =
{ {
[TL_Usr_FAV_UNF_NOTE] = Txt_TIMELINE_Not_favourited_by_anyone, [Tml_Usr_FAV_UNF_NOTE] = Txt_TIMELINE_Not_favourited_by_anyone,
[TL_Usr_FAV_UNF_COMM] = Txt_TIMELINE_Not_favourited_by_anyone, [Tml_Usr_FAV_UNF_COMM] = Txt_TIMELINE_Not_favourited_by_anyone,
[TL_Usr_SHA_UNS_NOTE] = Txt_TIMELINE_Not_shared_by_anyone, [Tml_Usr_SHA_UNS_NOTE] = Txt_TIMELINE_Not_shared_by_anyone,
}; };
/***** Disabled icon to fav/share *****/ /***** Disabled icon to fav/share *****/
@ -344,7 +344,7 @@ static void TL_Usr_PutDisabledIconFavSha (TL_Usr_FavSha_t FavSha,
/***************** Check if I can fav/share a note/comment *******************/ /***************** Check if I can fav/share a note/comment *******************/
/*****************************************************************************/ /*****************************************************************************/
bool TL_Usr_CheckIfICanFavSha (long Cod,long UsrCod) bool Tml_Usr_CheckIfICanFavSha (long Cod,long UsrCod)
{ {
extern const char *Txt_The_post_no_longer_exists; extern const char *Txt_The_post_no_longer_exists;
@ -370,7 +370,7 @@ bool TL_Usr_CheckIfICanFavSha (long Cod,long UsrCod)
/***************** Check if I can fav/share a note/comment *******************/ /***************** Check if I can fav/share a note/comment *******************/
/*****************************************************************************/ /*****************************************************************************/
bool TL_Usr_CheckIfICanRemove (long Cod,long UsrCod) bool Tml_Usr_CheckIfICanRemove (long Cod,long UsrCod)
{ {
extern const char *Txt_The_post_no_longer_exists; extern const char *Txt_The_post_no_longer_exists;

View File

@ -1,7 +1,7 @@
// swad_timeline_user.h: social timeline users // swad_timeline_user.h: social timeline users
#ifndef _SWAD_TL_USR #ifndef _SWAD_TML_USR
#define _SWAD_TL_USR #define _SWAD_TML_USR
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -36,8 +36,8 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_Usr_DEF_USRS_SHOWN 5 // Default maximum number of users shown who have share/fav a note #define Tml_Usr_DEF_USRS_SHOWN 5 // Default maximum number of users shown who have share/fav a note
#define TL_Usr_MAX_USRS_SHOWN 1000 // Top maximum number of users shown who have share/fav a note #define Tml_Usr_MAX_USRS_SHOWN 1000 // Top maximum number of users shown who have share/fav a note
/*****************************************************************************/ /*****************************************************************************/
/******************************** Public types *******************************/ /******************************** Public types *******************************/
@ -45,37 +45,37 @@
typedef enum typedef enum
{ {
TL_Usr_TIMELINE_USR, // Show the timeline of a user Tml_Usr_TIMELINE_USR, // Show the timeline of a user
TL_Usr_TIMELINE_GBL, // Show the timeline of the users follwed by me Tml_Usr_TIMELINE_GBL, // Show the timeline of the users follwed by me
} TL_Usr_UsrOrGbl_t; } Tml_Usr_UsrOrGbl_t;
typedef enum typedef enum
{ {
TL_Usr_SHOW_FEW_USRS, // Show a few first favers/sharers Tml_Usr_SHOW_FEW_USRS, // Show a few first favers/sharers
TL_Usr_SHOW_ALL_USRS, // Show all favers/sharers Tml_Usr_SHOW_ALL_USRS, // Show all favers/sharers
} TL_Usr_HowManyUsrs_t; } Tml_Usr_HowManyUsrs_t;
#define TL_Usr_NUM_FAV_SHA 3 #define Tml_Usr_NUM_FAV_SHA 3
typedef enum typedef enum
{ {
TL_Usr_FAV_UNF_NOTE = 0, Tml_Usr_FAV_UNF_NOTE = 0,
TL_Usr_FAV_UNF_COMM = 1, Tml_Usr_FAV_UNF_COMM = 1,
TL_Usr_SHA_UNS_NOTE = 2, Tml_Usr_SHA_UNS_NOTE = 2,
} TL_Usr_FavSha_t; } Tml_Usr_FavSha_t;
/*****************************************************************************/ /*****************************************************************************/
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Usr_RemoveUsrContent (long UsrCod); void Tml_Usr_RemoveUsrContent (long UsrCod);
bool TL_Usr_CheckIfFavedSharedByUsr (TL_Usr_FavSha_t FavSha,long Cod,long UsrCod); bool Tml_Usr_CheckIfFavedSharedByUsr (Tml_Usr_FavSha_t FavSha,long Cod,long UsrCod);
void TL_Usr_PutIconFavSha (TL_Usr_FavSha_t FavSha, void Tml_Usr_PutIconFavSha (Tml_Usr_FavSha_t FavSha,
long Cod,long UsrCod,unsigned NumUsrs, long Cod,long UsrCod,unsigned NumUsrs,
TL_Usr_HowManyUsrs_t HowManyUsrs); Tml_Usr_HowManyUsrs_t HowManyUsrs);
bool TL_Usr_CheckIfICanFavSha (long Cod,long UsrCod); bool Tml_Usr_CheckIfICanFavSha (long Cod,long UsrCod);
bool TL_Usr_CheckIfICanRemove (long Cod,long UsrCod); bool Tml_Usr_CheckIfICanRemove (long Cod,long UsrCod);
#endif #endif

View File

@ -58,17 +58,17 @@ Usr_Who_t TL_GlobalWho;
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static Usr_Who_t TL_Who_GetWhoFromDB (void); static Usr_Who_t Tml_Who_GetWhoFromDB (void);
static void TL_Who_SetGlobalWho (Usr_Who_t Who); static void Tml_Who_SetGlobalWho (Usr_Who_t Who);
static void TL_Who_ShowWarningYouDontFollowAnyUser (void); static void Tml_Who_ShowWarningYouDontFollowAnyUser (void);
/*****************************************************************************/ /*****************************************************************************/
/******** Show form to select users whom public activity is displayed ********/ /******** Show form to select users whom public activity is displayed ********/
/*****************************************************************************/ /*****************************************************************************/
void TL_Who_PutFormWho (struct TL_Timeline *Timeline) void Tml_Who_PutFormWho (struct Tml_Timeline *Timeline)
{ {
Usr_Who_t Who; Usr_Who_t Who;
unsigned Mask = 1 << Usr_WHO_ME | unsigned Mask = 1 << Usr_WHO_ME |
@ -106,14 +106,14 @@ void TL_Who_PutFormWho (struct TL_Timeline *Timeline)
/***** Show warning if I do not follow anyone *****/ /***** Show warning if I do not follow anyone *****/
if (Timeline->Who == Usr_WHO_FOLLOWED) if (Timeline->Who == Usr_WHO_FOLLOWED)
TL_Who_ShowWarningYouDontFollowAnyUser (); Tml_Who_ShowWarningYouDontFollowAnyUser ();
} }
/*****************************************************************************/ /*****************************************************************************/
/********* Get parameter with which users to view in global timeline *********/ /********* Get parameter with which users to view in global timeline *********/
/*****************************************************************************/ /*****************************************************************************/
void TL_Who_GetParamWho (void) void Tml_Who_GetParamWho (void)
{ {
Usr_Who_t Who; Usr_Who_t Who;
@ -122,21 +122,21 @@ void TL_Who_GetParamWho (void)
/***** If parameter Who is not present, get it from database *****/ /***** If parameter Who is not present, get it from database *****/
if (Who == Usr_WHO_UNKNOWN) if (Who == Usr_WHO_UNKNOWN)
Who = TL_Who_GetWhoFromDB (); Who = Tml_Who_GetWhoFromDB ();
/***** If parameter Who is unknown, set it to default *****/ /***** If parameter Who is unknown, set it to default *****/
if (Who == Usr_WHO_UNKNOWN) if (Who == Usr_WHO_UNKNOWN)
Who = TL_Who_DEFAULT_WHO; Who = Tml_Who_DEFAULT_WHO;
/***** Set global variable *****/ /***** Set global variable *****/
TL_Who_SetGlobalWho (Who); Tml_Who_SetGlobalWho (Who);
} }
/*****************************************************************************/ /*****************************************************************************/
/********* Get which users to view in global timeline from database **********/ /********* Get which users to view in global timeline from database **********/
/*****************************************************************************/ /*****************************************************************************/
static Usr_Who_t TL_Who_GetWhoFromDB (void) static Usr_Who_t Tml_Who_GetWhoFromDB (void)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
@ -144,7 +144,7 @@ static Usr_Who_t TL_Who_GetWhoFromDB (void)
Usr_Who_t Who = Usr_WHO_UNKNOWN; Usr_Who_t Who = Usr_WHO_UNKNOWN;
/***** Get which users from database *****/ /***** Get which users from database *****/
if (TL_DB_GetWho (&mysql_res) == 1) if (Tml_DB_GetWho (&mysql_res) == 1)
{ {
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
@ -164,16 +164,16 @@ static Usr_Who_t TL_Who_GetWhoFromDB (void)
/******** Save which users to view in global timeline into database **********/ /******** Save which users to view in global timeline into database **********/
/*****************************************************************************/ /*****************************************************************************/
void TL_Who_SaveWhoInDB (struct TL_Timeline *Timeline) void Tml_Who_SaveWhoInDB (struct Tml_Timeline *Timeline)
{ {
if (Gbl.Usrs.Me.Logged) // Save only if I am logged if (Gbl.Usrs.Me.Logged) // Save only if I am logged
{ {
if (Timeline->Who == Usr_WHO_UNKNOWN) if (Timeline->Who == Usr_WHO_UNKNOWN)
Timeline->Who = TL_Who_DEFAULT_WHO; Timeline->Who = Tml_Who_DEFAULT_WHO;
/***** Update which users in database *****/ /***** Update which users in database *****/
// Who is stored in usr_last for next time I log in // Who is stored in usr_last for next time I log in
TL_DB_UpdateWho (Timeline->Who); Tml_DB_UpdateWho (Timeline->Who);
} }
} }
@ -181,12 +181,12 @@ void TL_Who_SaveWhoInDB (struct TL_Timeline *Timeline)
/**** Set/get global variable with which users to view in global timeline ****/ /**** Set/get global variable with which users to view in global timeline ****/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Who_SetGlobalWho (Usr_Who_t Who) static void Tml_Who_SetGlobalWho (Usr_Who_t Who)
{ {
TL_GlobalWho = Who; TL_GlobalWho = Who;
} }
Usr_Who_t TL_Who_GetGlobalWho (void) Usr_Who_t Tml_Who_GetGlobalWho (void)
{ {
return TL_GlobalWho; return TL_GlobalWho;
} }
@ -195,7 +195,7 @@ Usr_Who_t TL_Who_GetGlobalWho (void)
/********* Get parameter with which users to view in global timeline *********/ /********* Get parameter with which users to view in global timeline *********/
/*****************************************************************************/ /*****************************************************************************/
static void TL_Who_ShowWarningYouDontFollowAnyUser (void) static void Tml_Who_ShowWarningYouDontFollowAnyUser (void)
{ {
extern const char *Txt_You_dont_follow_any_user; extern const char *Txt_You_dont_follow_any_user;
unsigned NumFollowing; unsigned NumFollowing;

View File

@ -1,7 +1,7 @@
// swad_timeline_who.c: select users whom timeline is displayed // swad_timeline_who.c: select users whom timeline is displayed
#ifndef _SWAD_TL_WHO #ifndef _SWAD_TML_WHO
#define _SWAD_TL_WHO #define _SWAD_TML_WHO
/* /*
SWAD (Shared Workspace At a Distance in Spanish), SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain), is a web platform developed at the University of Granada (Spain),
@ -33,7 +33,7 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define TL_Who_DEFAULT_WHO Usr_WHO_FOLLOWED #define Tml_Who_DEFAULT_WHO Usr_WHO_FOLLOWED
/*****************************************************************************/ /*****************************************************************************/
/******************************** Public types *******************************/ /******************************** Public types *******************************/
@ -43,12 +43,12 @@
/****************************** Public prototypes ****************************/ /****************************** Public prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
void TL_Who_PutFormWho (struct TL_Timeline *Timeline); void Tml_Who_PutFormWho (struct Tml_Timeline *Timeline);
void TL_Who_GetParamWho (void); void Tml_Who_GetParamWho (void);
void TL_Who_SaveWhoInDB (struct TL_Timeline *Timeline); void Tml_Who_SaveWhoInDB (struct Tml_Timeline *Timeline);
Usr_Who_t TL_Who_GetGlobalWho (void); Usr_Who_t Tml_Who_GetGlobalWho (void);
#endif #endif