diff --git a/js/swad18.58.js b/js/swad18.58.js index c3a9b368..ec4e136b 100644 --- a/js/swad18.58.js +++ b/js/swad18.58.js @@ -710,15 +710,14 @@ function refreshFav (elem,Params) { } } -// Receives and shows fav note area: icon and users who have faved a social note or comment in timeline +// Receives and shows fav area: icon and users who have faved a social note or comment in timeline function readAndUpdateFav () { if (objXMLHttpReqFavSoc.readyState == 4) { // Check if data have been received if (objXMLHttpReqFavSoc.status == 200) if (idDivFav) { - var htmlFav = objXMLHttpReqFavSoc.responseText; var divFav = document.getElementById(idDivFav); // Access to last click DIV if (divFav) - divFav.innerHTML = htmlFav; // Update fav area DIV + divFav.innerHTML = objXMLHttpReqFavSoc.responseText; // Update fav area DIV } } } diff --git a/sql/cambios.sql b/sql/cambios.sql index 8d627633..ba9f8f6b 100644 --- a/sql/cambios.sql +++ b/sql/cambios.sql @@ -12611,3 +12611,8 @@ ORDER BY FavCod LIMIT 7 SELECT UsrCod FROM social_notes_fav WHERE NotCod=278 AND UsrCod<>7 AND UsrCod<>1 ORDER BY FavCod LIMIT 7; SELECT CAST(~0 AS UNSIGNED); + + +SELECT last_logs.LogCod,last_logs.ActCod,last_logs.Dif,last_logs.Role,last_logs.CtyCod,last_logs.InsCod,last_logs.CtrCod,last_logs.DegCod,actions.Txt FROM (SELECT LogCod,ActCod,UNIX_TIMESTAMP()-UNIX_TIMESTAMP(ClickTime) AS Dif,Role,CtyCod,InsCod,CtrCod,DegCod FROM log_recent ORDER BY LogCod DESC LIMIT 20) AS last_logs LEFT JOIN actions ON last_logs.ActCod=actions.ActCod WHERE actions.Language='es'; + + diff --git a/swad_changelog.h b/swad_changelog.h index e79d683e..bb0c83ba 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -429,10 +429,23 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.58 (2019-02-24)" +#define Log_PLATFORM_VERSION "SWAD 18.58.1 (2019-02-24)" #define CSS_FILE "swad18.57.css" #define JS_FILE "swad18.58.js" /* + Version 18.58.1: Feb 24, 2019 Code cleaning related to AJAX and timeline. + Fixed bug in recent clicks. (237768 lines) + 9 changes necessary in database: +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1512','es','N','Favorito public. social (global)'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1513','es','N','Deshacer fav. public. social (global)'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1514','es','N','Favorito public. social (usuario)'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1515','es','N','Deshacer fav. public. social (usuario)'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1516','es','N','Favorito coment. social (global)'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1517','es','N','Deshacer fav. coment. social (global)'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1518','es','N','Favorito coment. social (usuario)'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1519','es','N','Deshacer fav. coment. social (usuario)'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1520','es','N','Sugerir lista de usuarios a seguir'); + Version 18.58: Feb 24, 2019 Favourites in social comments are made in AJAX without reloading page. (237816 lines) Version 18.57.3: Feb 24, 2019 Changes in social timeline related to AJAX and favourites. (237804 lines) Version 18.57.2: Feb 24, 2019 Changes in social timeline related to AJAX and favourites. (237827 lines) diff --git a/swad_form.c b/swad_form.c index 9a27edf4..561089f5 100644 --- a/swad_form.c +++ b/swad_form.c @@ -165,45 +165,47 @@ void Frm_SetParamsForm (char ParamsStr[Frm_MAX_BYTES_PARAMS_STR + 1],Act_Action_ ParamLocation[0] = '\0'; if (NextAction != ActUnk) + { snprintf (ParamAction,sizeof (ParamAction), "", Act_GetActCod (NextAction)); - if (Gbl.Session.Id[0]) - snprintf (ParamSession,sizeof (ParamSession), - "", - Gbl.Session.Id); - else if (PutParameterLocationIfNoSesion) - // Extra parameters necessary when there's no open session - { - /* If session is open, course code will be get from session data, - but if there is not an open session, and next action is known, - it is necessary to send a parameter with course code */ - if (Gbl.CurrentCrs.Crs.CrsCod > 0) - // If course selected... - snprintf (ParamLocation,sizeof (ParamLocation), - "", - Gbl.CurrentCrs.Crs.CrsCod); - else if (Gbl.CurrentDeg.Deg.DegCod > 0) - // If no course selected, but degree selected... - snprintf (ParamLocation,sizeof (ParamLocation), - "", - Gbl.CurrentDeg.Deg.DegCod); - else if (Gbl.CurrentCtr.Ctr.CtrCod > 0) - // If no degree selected, but centre selected... - snprintf (ParamLocation,sizeof (ParamLocation), - "", - Gbl.CurrentCtr.Ctr.CtrCod); - else if (Gbl.CurrentIns.Ins.InsCod > 0) - // If no centre selected, but institution selected... - snprintf (ParamLocation,sizeof (ParamLocation), - "", - Gbl.CurrentIns.Ins.InsCod); - else if (Gbl.CurrentCty.Cty.CtyCod > 0) - // If no institution selected, but country selected... - snprintf (ParamLocation,sizeof (ParamLocation), - "", - Gbl.CurrentCty.Cty.CtyCod); + if (Gbl.Session.Id[0]) + snprintf (ParamSession,sizeof (ParamSession), + "", + Gbl.Session.Id); + else if (PutParameterLocationIfNoSesion) + // Extra parameters necessary when there's no open session + { + /* If session is open, course code will be get from session data, + but if there is not an open session, and next action is known, + it is necessary to send a parameter with course code */ + if (Gbl.CurrentCrs.Crs.CrsCod > 0) + // If course selected... + snprintf (ParamLocation,sizeof (ParamLocation), + "", + Gbl.CurrentCrs.Crs.CrsCod); + else if (Gbl.CurrentDeg.Deg.DegCod > 0) + // If no course selected, but degree selected... + snprintf (ParamLocation,sizeof (ParamLocation), + "", + Gbl.CurrentDeg.Deg.DegCod); + else if (Gbl.CurrentCtr.Ctr.CtrCod > 0) + // If no degree selected, but centre selected... + snprintf (ParamLocation,sizeof (ParamLocation), + "", + Gbl.CurrentCtr.Ctr.CtrCod); + else if (Gbl.CurrentIns.Ins.InsCod > 0) + // If no centre selected, but institution selected... + snprintf (ParamLocation,sizeof (ParamLocation), + "", + Gbl.CurrentIns.Ins.InsCod); + else if (Gbl.CurrentCty.Cty.CtyCod > 0) + // If no institution selected, but country selected... + snprintf (ParamLocation,sizeof (ParamLocation), + "", + Gbl.CurrentCty.Cty.CtyCod); + } } snprintf (ParamsStr,Frm_MAX_BYTES_PARAMS_STR + 1, diff --git a/swad_layout.c b/swad_layout.c index 918c3234..52fd8e3a 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -679,10 +679,6 @@ static void Lay_WriteScriptInit (void) case ActRcvSocComGbl: case ActShaSocNotGbl: case ActUnsSocNotGbl: - case ActFavSocNotGbl: - case ActUnfSocNotGbl: - case ActFavSocComGbl: - case ActUnfSocComGbl: case ActReqRemSocPubGbl: case ActRemSocPubGbl: case ActReqRemSocComGbl: @@ -694,7 +690,6 @@ static void Lay_WriteScriptInit (void) default: break; } - // fprintf (Gbl.F.Out," document.getElementById('whole_page').style.opacity='1';\n"); fprintf (Gbl.F.Out,"}\n" "\n"); } @@ -733,10 +728,6 @@ static void Lay_WriteScriptParamsAJAX (void) case ActRcvSocComGbl: case ActShaSocNotGbl: case ActUnsSocNotGbl: - case ActFavSocNotGbl: - case ActUnfSocNotGbl: - case ActFavSocComGbl: - case ActUnfSocComGbl: case ActReqRemSocPubGbl: case ActRemSocPubGbl: case ActReqRemSocComGbl: @@ -757,10 +748,6 @@ static void Lay_WriteScriptParamsAJAX (void) case ActRcvSocComUsr: case ActShaSocNotUsr: case ActUnsSocNotUsr: - case ActFavSocNotUsr: - case ActUnfSocNotUsr: - case ActFavSocComUsr: - case ActUnfSocComUsr: case ActReqRemSocPubUsr: case ActRemSocPubUsr: case ActReqRemSocComUsr: @@ -1293,25 +1280,9 @@ void Lay_ShowErrorAndExit (const char *Txt) Lay_WriteEndOfPage (); } - if (Gbl.Action.Act == ActFavSocNotGbl || - Gbl.Action.Act == ActUnfSocNotGbl) - DB_QueryINSERT ("can not debug", - "INSERT INTO debug" - " (DebugTime,Txt)" - " VALUES" - " (NOW(),'antes de Gbl_Cleanup')"); - /***** Free memory and close all the open files *****/ Gbl_Cleanup (); - if (Gbl.Action.Act == ActFavSocNotGbl || - Gbl.Action.Act == ActUnfSocNotGbl) - DB_QueryINSERT ("can not debug", - "INSERT INTO debug" - " (DebugTime,Txt)" - " VALUES" - " (NOW(),'tras Gbl_Cleanup')"); - /***** Page is generated (except and ). Compute time to generate page *****/ if (!Gbl.Action.IsAJAXAutoRefresh) @@ -1354,14 +1325,6 @@ void Lay_ShowErrorAndExit (const char *Txt) } } - if (Gbl.Action.Act == ActFavSocNotGbl || - Gbl.Action.Act == ActUnfSocNotGbl) - DB_QueryINSERT ("can not debug", - "INSERT INTO debug" - " (DebugTime,Txt)" - " VALUES" - " (NOW(),'antes de DB_CloseDBConnection')"); - /***** Close database connection *****/ DB_CloseDBConnection (); diff --git a/swad_main.c b/swad_main.c index eeb68e26..4f206428 100644 --- a/swad_main.c +++ b/swad_main.c @@ -152,39 +152,15 @@ int main (void) /***** Write HTTP Status 204 No Content *****/ Lay_WriteHTTPStatus204NoContent (); - if (Gbl.Action.Act == ActFavSocNotGbl || - Gbl.Action.Act == ActUnfSocNotGbl) - DB_QueryINSERT ("can not debug", - "INSERT INTO debug" - " (DebugTime,Txt)" - " VALUES" - " (NOW(),'tras FunctionPriori')"); - /***** Start writing HTML output *****/ Lay_WriteStartOfPage (); - if (Gbl.Action.Act == ActFavSocNotGbl || - Gbl.Action.Act == ActUnfSocNotGbl) - DB_QueryINSERT ("can not debug", - "INSERT INTO debug" - " (DebugTime,Txt)" - " VALUES" - " (NOW(),'antes de FunctionPosteriori')"); - /***** Make a processing or other depending on the action *****/ FunctionPosteriori = Act_GetFunctionPosteriori (Gbl.Action.Act); if (FunctionPosteriori != NULL) FunctionPosteriori (); } - if (Gbl.Action.Act == ActFavSocNotGbl || - Gbl.Action.Act == ActUnfSocNotGbl) - DB_QueryINSERT ("can not debug", - "INSERT INTO debug" - " (DebugTime,Txt)" - " VALUES" - " (NOW(),'antes de Lay_ShowErrorAndExit')"); - /***** Cleanup and exit *****/ Lay_ShowErrorAndExit (NULL); diff --git a/swad_parameter.c b/swad_parameter.c index 7fe05b26..ae2af19f 100644 --- a/swad_parameter.c +++ b/swad_parameter.c @@ -727,23 +727,26 @@ void Par_GetMainParameters (void) Gbl.Action.Act = Gbl.Action.Original = Act_FromActCodToAction[ActCod]; /***** Some preliminary adjusts depending on action *****/ - Gbl.Action.UsesAJAX = false; - Gbl.Action.IsAJAXAutoRefresh = false; if (Gbl.Action.Act == ActRefCon || Gbl.Action.Act == ActRefLstClk || - Gbl.Action.Act == ActRefNewSocPubGbl || - Gbl.Action.Act == ActRefOldSocPubGbl || - Gbl.Action.Act == ActRefOldSocPubUsr || - Gbl.Action.Act == ActFavSocNotGbl || Gbl.Action.Act == ActFavSocNotUsr || - Gbl.Action.Act == ActUnfSocNotGbl || Gbl.Action.Act == ActUnfSocNotUsr || - Gbl.Action.Act == ActFavSocComGbl || Gbl.Action.Act == ActFavSocComUsr || - Gbl.Action.Act == ActUnfSocComGbl || Gbl.Action.Act == ActUnfSocComUsr) + Gbl.Action.Act == ActRefNewSocPubGbl) + { + Gbl.Action.UsesAJAX = true; + Gbl.Action.IsAJAXAutoRefresh = true; + } + else if (Gbl.Action.Act == ActRefOldSocPubGbl || Gbl.Action.Act == ActRefOldSocPubUsr || + Gbl.Action.Act == ActFavSocNotGbl || Gbl.Action.Act == ActFavSocNotUsr || + Gbl.Action.Act == ActUnfSocNotGbl || Gbl.Action.Act == ActUnfSocNotUsr || + Gbl.Action.Act == ActFavSocComGbl || Gbl.Action.Act == ActFavSocComUsr || + Gbl.Action.Act == ActUnfSocComGbl || Gbl.Action.Act == ActUnfSocComUsr) { - Gbl.Action.UsesAJAX = true; - if (Gbl.Action.Act == ActRefCon || - Gbl.Action.Act == ActRefLstClk || - Gbl.Action.Act == ActRefNewSocPubGbl) - Gbl.Action.IsAJAXAutoRefresh = true; + Gbl.Action.UsesAJAX = true; + Gbl.Action.IsAJAXAutoRefresh = false; + } + else + { + Gbl.Action.UsesAJAX = false; + Gbl.Action.IsAJAXAutoRefresh = false; } /***** Get session identifier, if exists *****/ diff --git a/swad_social.c b/swad_social.c index 6c5281e0..69941e6a 100644 --- a/swad_social.c +++ b/swad_social.c @@ -194,16 +194,15 @@ static void Soc_WriteSocialComment (struct SocialComment *SocCom, static void Soc_WriteAuthorComment (struct UsrData *UsrDat); static void Soc_PutFormToRemoveComment (long PubCod); -static void Soc_PutFormToFavSocialComment (struct SocialComment *SocCom); static void Soc_PutDisabledIconShare (unsigned NumShared); static void Soc_PutDisabledIconFav (unsigned NumFavs); static void Soc_PutFormToShareSocialNote (long NotCod); +static void Soc_PutFormToUnshareSocialNote (long NotCod); static void Soc_PutFormToFavSocialNote (const struct SocialNote *SocNot); static void Soc_PutFormToUnfavSocialNote (const struct SocialNote *SocNot); - -static void Soc_PutFormToUnshareSocialNote (long NotCod); +static void Soc_PutFormToFavSocialComment (struct SocialComment *SocCom); static void Soc_PutFormToUnfavSocialComment (struct SocialComment *SocCom); static void Soc_PutFormToRemoveSocialPublishing (long NotCod); @@ -2782,52 +2781,6 @@ static void Soc_PutFormToRemoveComment (long PubCod) Frm_EndForm (); } -/*****************************************************************************/ -/***************** Form to mark a social comment as favourite ****************/ -/*****************************************************************************/ -// All forms in this function and nested functions must have unique identifiers - -static void Soc_PutFormToFavSocialComment (struct SocialComment *SocCom) - { - extern const char *Txt_Mark_as_favourite; - char *OnSubmit; - - /***** Form and icon to mark social note as favourite *****/ - /* Form with icon */ - if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) - { - if (asprintf (&OnSubmit,"refreshFav(this," - "'act=%ld&ses=%s&PubCod=%ld&OtherUsrCod=%s');" - " return false;", // return false is necessary to not submit form - Act_GetActCod (ActFavSocComUsr), - Gbl.Session.Id, - SocCom->PubCod, - Gbl.Usrs.Other.UsrDat.EncryptedUsrCod) < 0) - Lay_NotEnoughMemoryExit (); - Frm_StartFormUniqueAnchorOnSubmit (ActFavSocComUsr,"timeline",OnSubmit); - } - else - { - if (asprintf (&OnSubmit,"refreshFav(this," - "'act=%ld&ses=%s&PubCod=%ld&WhichUsrs=%u');" - " return false;", // return false is necessary to not submit form - Act_GetActCod (ActFavSocComGbl), - Gbl.Session.Id, - SocCom->PubCod, - (unsigned) Gbl.Social.WhichUsrs) < 0) - Lay_NotEnoughMemoryExit (); - Frm_StartFormUniqueAnchorOnSubmit (ActFavSocComGbl,NULL,OnSubmit); - } - Ico_PutIconLink ("heart.svg",Txt_Mark_as_favourite); - Frm_EndForm (); - - /* Free allocated memory for subquery */ - free ((void *) OnSubmit); - - /***** Show who have marked this social comment as favourite *****/ - Soc_ShowUsrsWhoHaveMarkedSocialCommAsFav (SocCom); - } - /*****************************************************************************/ /*********************** Put disabled icon to share **************************/ /*****************************************************************************/ @@ -2889,6 +2842,23 @@ static void Soc_PutFormToShareSocialNote (long NotCod) Frm_EndForm (); } +/*****************************************************************************/ +/*************** Form to unshare (stop sharing) social note ******************/ +/*****************************************************************************/ +// All forms in this function and nested functions must have unique identifiers + +static void Soc_PutFormToUnshareSocialNote (long NotCod) + { + extern const char *Txt_SOCIAL_NOTE_Shared; + + /***** Form to share social publishing *****/ + Soc_FormStart (ActUnsSocNotGbl,ActUnsSocNotUsr); + Soc_PutHiddenParamNotCod (NotCod); + Ico_PutDivIconLink ("SOCIAL_ICO_SHARE", + "share-alt-green.svg",Txt_SOCIAL_NOTE_Shared); + Frm_EndForm (); + } + /*****************************************************************************/ /*************** Form to fav (mark as favourite) social note *****************/ /*****************************************************************************/ @@ -2911,19 +2881,18 @@ static void Soc_PutFormToFavSocialNote (const struct SocialNote *SocNot) SocNot->NotCod, Gbl.Usrs.Other.UsrDat.EncryptedUsrCod) < 0) Lay_NotEnoughMemoryExit (); - Frm_StartFormUniqueAnchorOnSubmit (ActFavSocNotUsr,"timeline",OnSubmit); + Frm_StartFormUniqueAnchorOnSubmit (ActUnk,"timeline",OnSubmit); } else { if (asprintf (&OnSubmit,"refreshFav(this," - "'act=%ld&ses=%s&NotCod=%ld&WhichUsrs=%u');" + "'act=%ld&ses=%s&NotCod=%ld');" " return false;", // return false is necessary to not submit form Act_GetActCod (ActFavSocNotGbl), Gbl.Session.Id, - SocNot->NotCod, - (unsigned) Gbl.Social.WhichUsrs) < 0) + SocNot->NotCod) < 0) Lay_NotEnoughMemoryExit (); - Frm_StartFormUniqueAnchorOnSubmit (ActFavSocNotGbl,NULL,OnSubmit); + Frm_StartFormUniqueAnchorOnSubmit (ActUnk,NULL,OnSubmit); } Ico_PutIconLink ("heart.svg",Txt_Mark_as_favourite); Frm_EndForm (); @@ -2957,19 +2926,18 @@ static void Soc_PutFormToUnfavSocialNote (const struct SocialNote *SocNot) SocNot->NotCod, Gbl.Usrs.Other.UsrDat.EncryptedUsrCod) < 0) Lay_NotEnoughMemoryExit (); - Frm_StartFormUniqueAnchorOnSubmit (ActUnfSocNotUsr,"timeline",OnSubmit); + Frm_StartFormUniqueAnchorOnSubmit (ActUnk,"timeline",OnSubmit); } else { if (asprintf (&OnSubmit,"refreshFav(this," - "'act=%ld&ses=%s&NotCod=%ld&WhichUsrs=%u');" + "'act=%ld&ses=%s&NotCod=%ld');" " return false;", // return false is necessary to not submit form Act_GetActCod (ActUnfSocNotGbl), Gbl.Session.Id, - SocNot->NotCod, - (unsigned) Gbl.Social.WhichUsrs) < 0) + SocNot->NotCod) < 0) Lay_NotEnoughMemoryExit (); - Frm_StartFormUniqueAnchorOnSubmit (ActUnfSocNotGbl,NULL,OnSubmit); + Frm_StartFormUniqueAnchorOnSubmit (ActUnk,NULL,OnSubmit); } Ico_PutIconLink ("heart-red.svg",Txt_SOCIAL_NOTE_Favourite); Frm_EndForm (); @@ -2981,21 +2949,50 @@ static void Soc_PutFormToUnfavSocialNote (const struct SocialNote *SocNot) Soc_ShowUsrsWhoHaveMarkedSocialNoteAsFav (SocNot); } + /*****************************************************************************/ -/*************** Form to unshare (stop sharing) social note ******************/ +/***************** Form to mark a social comment as favourite ****************/ /*****************************************************************************/ // All forms in this function and nested functions must have unique identifiers -static void Soc_PutFormToUnshareSocialNote (long NotCod) +static void Soc_PutFormToFavSocialComment (struct SocialComment *SocCom) { - extern const char *Txt_SOCIAL_NOTE_Shared; + extern const char *Txt_Mark_as_favourite; + char *OnSubmit; - /***** Form to share social publishing *****/ - Soc_FormStart (ActUnsSocNotGbl,ActUnsSocNotUsr); - Soc_PutHiddenParamNotCod (NotCod); - Ico_PutDivIconLink ("SOCIAL_ICO_SHARE", - "share-alt-green.svg",Txt_SOCIAL_NOTE_Shared); + /***** Form and icon to mark social note as favourite *****/ + /* Form with icon */ + if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) + { + if (asprintf (&OnSubmit,"refreshFav(this," + "'act=%ld&ses=%s&PubCod=%ld&OtherUsrCod=%s');" + " return false;", // return false is necessary to not submit form + Act_GetActCod (ActFavSocComUsr), + Gbl.Session.Id, + SocCom->PubCod, + Gbl.Usrs.Other.UsrDat.EncryptedUsrCod) < 0) + Lay_NotEnoughMemoryExit (); + Frm_StartFormUniqueAnchorOnSubmit (ActUnk,"timeline",OnSubmit); + } + else + { + if (asprintf (&OnSubmit,"refreshFav(this," + "'act=%ld&ses=%s&PubCod=%ld');" + " return false;", // return false is necessary to not submit form + Act_GetActCod (ActFavSocComGbl), + Gbl.Session.Id, + SocCom->PubCod) < 0) + Lay_NotEnoughMemoryExit (); + Frm_StartFormUniqueAnchorOnSubmit (ActUnk,NULL,OnSubmit); + } + Ico_PutIconLink ("heart.svg",Txt_Mark_as_favourite); Frm_EndForm (); + + /* Free allocated memory for subquery */ + free ((void *) OnSubmit); + + /***** Show who have marked this social comment as favourite *****/ + Soc_ShowUsrsWhoHaveMarkedSocialCommAsFav (SocCom); } /*****************************************************************************/ @@ -3020,19 +3017,18 @@ static void Soc_PutFormToUnfavSocialComment (struct SocialComment *SocCom) SocCom->PubCod, Gbl.Usrs.Other.UsrDat.EncryptedUsrCod) < 0) Lay_NotEnoughMemoryExit (); - Frm_StartFormUniqueAnchorOnSubmit (ActUnfSocComUsr,"timeline",OnSubmit); + Frm_StartFormUniqueAnchorOnSubmit (ActUnk,"timeline",OnSubmit); } else { if (asprintf (&OnSubmit,"refreshFav(this," - "'act=%ld&ses=%s&PubCod=%ld&WhichUsrs=%u');" + "'act=%ld&ses=%s&PubCod=%ld');" " return false;", // return false is necessary to not submit form Act_GetActCod (ActUnfSocComGbl), Gbl.Session.Id, - SocCom->PubCod, - (unsigned) Gbl.Social.WhichUsrs) < 0) + SocCom->PubCod) < 0) Lay_NotEnoughMemoryExit (); - Frm_StartFormUniqueAnchorOnSubmit (ActUnfSocComGbl,NULL,OnSubmit); + Frm_StartFormUniqueAnchorOnSubmit (ActUnk,NULL,OnSubmit); } Ico_PutIconLink ("heart-red.svg",Txt_SOCIAL_NOTE_Favourite); Frm_EndForm (); @@ -3302,9 +3298,6 @@ void Soc_FavSocialNoteGbl (void) { struct SocialNote SocNot; - /***** Get which users *****/ - Soc_GetParamsWhichUsrs (); - /***** Mark social note as favourite *****/ Soc_FavSocialNote (&SocNot); @@ -3357,11 +3350,11 @@ static void Soc_FavSocialNote (struct SocialNote *SocNot) SocNot->NotCod, Gbl.Usrs.Me.UsrDat.UsrCod); - /* Update number of times this social note is favourited */ + /***** Update number of times this social note is favourited**** */ Soc_GetNumTimesANoteHasBeenFav (SocNot); - /**** Create notification about favourite post - for the author of the post ***/ + /***** Create notification about favourite post + for the author of the post *****/ OriginalPubCod = Soc_GetPubCodOfOriginalSocialNote (SocNot->NotCod); if (OriginalPubCod > 0) Soc_CreateNotifToAuthor (SocNot->UsrCod,OriginalPubCod,Ntf_EVENT_TIMELINE_FAV); @@ -3377,9 +3370,6 @@ void Soc_FavSocialCommentGbl (void) { struct SocialComment SocCom; - /***** Get which users *****/ - Soc_GetParamsWhichUsrs (); - /***** Mark social comment as favourite *****/ Soc_FavSocialComment (&SocCom); @@ -3578,9 +3568,6 @@ void Soc_UnfavSocialNoteGbl (void) { struct SocialNote SocNot; - /***** Get which users *****/ - Soc_GetParamsWhichUsrs (); - /***** Stop marking as favourite a previously favourited social note *****/ Soc_UnfavSocialNote (&SocNot); @@ -3651,9 +3638,6 @@ void Soc_UnfavSocialCommentGbl (void) { struct SocialComment SocCom; - /***** Get which users *****/ - Soc_GetParamsWhichUsrs (); - /***** Stop marking as favourite a previously favourited social comment *****/ Soc_UnfavSocialComment (&SocCom); diff --git a/swad_statistic.c b/swad_statistic.c index bd042d6b..70982801 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -4117,9 +4117,10 @@ void Sta_GetAndShowLastClicks (void) "UNIX_TIMESTAMP()-UNIX_TIMESTAMP(ClickTime) AS Dif," "Role,CtyCod,InsCod,CtrCod,DegCod" " FROM log_recent ORDER BY LogCod DESC LIMIT 20)" - " AS last_logs,actions" - " WHERE last_logs.ActCod=actions.ActCod" - " AND actions.Language='es'"); + " AS last_logs LEFT JOIN actions" // LEFT JOIN because action may be not present in table of actions + " ON last_logs.ActCod=actions.ActCod" + " WHERE actions.Language='es'" // TODO: Change to user's language + " OR actions.Language IS NULL"); // When action is not present in table of actions /***** Write list of connected users *****/ Tbl_StartTableCenter (1); @@ -4229,16 +4230,18 @@ void Sta_GetAndShowLastClicks (void) "" "%s" // Degree "" - "" - "%s" // Action - "" - "", + "", ClassRow,Txt_ROLES_SINGUL_Abc[Rol_ConvertUnsignedStrToRole (row[3])][Usr_SEX_UNKNOWN], ClassRow,Cty.Name[Gbl.Prefs.Language], ClassRow,Ins.ShrtName, ClassRow,Ctr.ShrtName, ClassRow,Deg.ShrtName, - ClassRow,row[8]); + ClassRow); + if (row[8]) + if (row[8][0]) + fprintf (Gbl.F.Out,"%s",row[8]); // Action + fprintf (Gbl.F.Out,"" + ""); } Tbl_EndTable ();