From 8a5258326208fb4aad6dd998c2c003ccc63aed06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Fri, 24 Feb 2017 10:34:21 +0100 Subject: [PATCH] Version 16.140.1 --- swad_changelog.h | 7 ++- swad_social.c | 150 ++++++++++++++++------------------------------- 2 files changed, 57 insertions(+), 100 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index d77ad5f74..a8b43f0cd 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -197,19 +197,22 @@ // TODO: Un administrador de institución, ¿debería poder cambiar la contraseña de un usuario de esa institución? No lo tengo claro. -// TODO: Put hidden parameter "WhichUsrs" in all actions related to global timeline +// TODO: Fix bug reported by Nuria Torres Rosell: Ayer y hoy he intentado crear preguntas test con la opción V/F y, pese a seleccionar como respuesta correcta una de las dos, no me deja crear la pregunta. Constantemente me dice que debo seleccionar V o F. +// Por ahora me voy "apañando" con opción única y las respuestas Si o No. Pero resulta un poco raro. /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.140 (2017-02-24)" +#define Log_PLATFORM_VERSION "SWAD 16.140.1 (2017-02-24)" #define CSS_FILE "swad16.139.6.css" #define JS_FILE "swad16.140.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.140.1: Feb 24, 2017 Hidden parameter with users to view in all actions related to global timeline. + Code refactoring of forms in social timeline. (212993 lines) Version 16.140: Feb 24, 2017 Two global timelines available: users I follow and all users. Not finished. (213039 lines) Version 16.139.6: Feb 24, 2017 Code refactoring in selector of which forums to display. (? lines) Version 16.139.5: Feb 22, 2017 Changed contextual links in my profile. (212832 lines) diff --git a/swad_social.c b/swad_social.c index 755e48bb5..2ac945c29 100644 --- a/swad_social.c +++ b/swad_social.c @@ -148,7 +148,10 @@ static void Soc_ShowTimeline (const char *Query,const char *Title, long NotCodToHighlight); static void Soc_PutIconsTimeline (void); +static void Soc_FormStart (Act_Action_t ActionGbl,Act_Action_t ActionUsr); + static void Soc_PutFormWhichUsrs (void); +static void Soc_PutParamWhichUsrs (void); static void Soc_GetParamsWhichUsrs (void); static void Soc_InsertNewPubsInTimeline (const char *Query); @@ -1004,6 +1007,24 @@ static void Soc_PutIconsTimeline (void) Sta_PutIconToShowFigure (); } +/*****************************************************************************/ +/***************** Start a form in global or user timeline *******************/ +/*****************************************************************************/ + +static void Soc_FormStart (Act_Action_t ActionGbl,Act_Action_t ActionUsr) + { + if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) + { + Act_FormStartAnchor (ActionUsr,"timeline"); + Usr_PutParamOtherUsrCodEncrypted (); + } + else + { + Act_FormStart (ActionGbl); + Soc_PutParamWhichUsrs (); + } + } + /*****************************************************************************/ /******** Put form to select users whom public activity is displayed *********/ /*****************************************************************************/ @@ -1042,6 +1063,15 @@ static void Soc_PutFormWhichUsrs (void) Act_FormEnd (); } +/*****************************************************************************/ +/***** Put hidden parameter with which users to view in global timeline ******/ +/*****************************************************************************/ + +static void Soc_PutParamWhichUsrs (void) + { + Par_PutHiddenParamUnsigned ("WhichUsrs",Gbl.Social.WhichUsrs); + } + /*****************************************************************************/ /********* Get parameter with which users to view in global timeline *********/ /*****************************************************************************/ @@ -2123,26 +2153,21 @@ static void Soc_PutFormToWriteNewPost (void) "", FullName,Gbl.Usrs.Me.UsrDat.Nickname); - /***** Start container *****/ + /***** Form to write the post *****/ + /* Start container */ fprintf (Gbl.F.Out,"
"); /* Start form to write the post */ - if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) - { - Act_FormStartAnchor (ActRcvSocPstUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStart (ActRcvSocPstGbl); + Soc_FormStart (ActRcvSocPstGbl,ActRcvSocPstUsr); - /***** Textarea and button *****/ + /* Textarea and button */ Soc_PutTextarea (Txt_New_SOCIAL_post, "SOCIAL_TEXTAREA_POST","SOCIAL_POST_IMG_TIT_URL"); - /***** End form *****/ + /* End form */ Act_FormEnd (); - /***** End container *****/ + /* End container */ fprintf (Gbl.F.Out,"
"); /***** End list *****/ @@ -2367,26 +2392,21 @@ static void Soc_PutHiddenFormToWriteNewCommentToSocialNote (long NotCod, fprintf (Gbl.F.Out,""); /***** Right: form to write the comment *****/ + /* Start right container */ fprintf (Gbl.F.Out,"
"); - /***** Start form to write the post *****/ - if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) - { - Act_FormStartUniqueAnchor (ActRcvSocComUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStartUnique (ActRcvSocComGbl); + /* Start form to write the post */ + Soc_FormStart (ActRcvSocComGbl,ActRcvSocComUsr); Soc_PutHiddenParamNotCod (NotCod); - /***** Textarea and button *****/ + /* Textarea and button */ Soc_PutTextarea (Txt_New_SOCIAL_comment, "SOCIAL_TEXTAREA_COMMENT","SOCIAL_COMMENT_IMG_TIT_URL"); - /***** End form *****/ + /* End form */ Act_FormEnd (); - /***** End right container *****/ + /* End right container */ fprintf (Gbl.F.Out,"
"); /***** End container *****/ @@ -2631,13 +2651,7 @@ static void Soc_PutFormToRemoveComment (long PubCod) extern const char *Txt_Remove; /***** Form to remove social publishing *****/ - if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) - { - Act_FormStartUniqueAnchor (ActReqRemSocComUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStartUnique (ActReqRemSocComGbl); + Soc_FormStart (ActReqRemSocComGbl,ActReqRemSocComUsr); Soc_PutHiddenParamPubCod (PubCod); fprintf (Gbl.F.Out,"
" " 0) - { - Act_FormStartUniqueAnchor (ActFavSocComUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStartUnique (ActFavSocComGbl); + Soc_FormStart (ActFavSocComGbl,ActFavSocComUsr); Soc_PutHiddenParamPubCod (PubCod); fprintf (Gbl.F.Out,"
" " 0) - { - Act_FormStartUniqueAnchor (ActShaSocNotUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStartUnique (ActShaSocNotGbl); + Soc_FormStart (ActShaSocNotGbl,ActShaSocNotUsr); Soc_PutHiddenParamNotCod (NotCod); fprintf (Gbl.F.Out,"
" " 0) - { - Act_FormStartUniqueAnchor (ActFavSocNotUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStartUnique (ActFavSocNotGbl); + Soc_FormStart (ActFavSocNotGbl,ActFavSocNotUsr); Soc_PutHiddenParamNotCod (NotCod); fprintf (Gbl.F.Out,"
" " 0) - { - Act_FormStartUniqueAnchor (ActUnsSocNotUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStartUnique (ActUnsSocNotGbl); + Soc_FormStart (ActUnsSocNotGbl,ActUnsSocNotUsr); Soc_PutHiddenParamNotCod (NotCod); fprintf (Gbl.F.Out,"
" " 0) - { - Act_FormStartUniqueAnchor (ActUnfSocNotUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStartUnique (ActUnfSocNotGbl); + Soc_FormStart (ActUnfSocNotGbl,ActUnfSocNotUsr); Soc_PutHiddenParamNotCod (NotCod); fprintf (Gbl.F.Out,"
" " 0) - { - Act_FormStartUniqueAnchor (ActUnfSocComUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStartUnique (ActUnfSocComGbl); + Soc_FormStart (ActUnfSocComGbl,ActUnfSocComUsr); Soc_PutHiddenParamPubCod (PubCod); fprintf (Gbl.F.Out,"
" " 0) - { - Act_FormStartUniqueAnchor (ActReqRemSocPubUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStartUnique (ActReqRemSocPubGbl); + Soc_FormStart (ActReqRemSocPubGbl,ActReqRemSocPubUsr); Soc_PutHiddenParamNotCod (NotCod); fprintf (Gbl.F.Out,"
" " 0) - { - Act_FormStartAnchor (ActRemSocPubUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStart (ActRemSocPubGbl); + Soc_FormStart (ActRemSocPubGbl,ActRemSocPubUsr); Soc_PutHiddenParamNotCod (SocNot.NotCod); - - /* End form */ Lay_PutRemoveButton (Txt_Remove); Act_FormEnd (); } @@ -4002,17 +3965,8 @@ static void Soc_RequestRemovalSocialComment (void) true); /***** Form to ask for confirmation to remove this social comment *****/ - /* Start form */ - if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) - { - Act_FormStartAnchor (ActRemSocComUsr,"timeline"); - Usr_PutParamOtherUsrCodEncrypted (); - } - else - Act_FormStart (ActRemSocComGbl); + Soc_FormStart (ActRemSocComGbl,ActRemSocComUsr); Soc_PutHiddenParamPubCod (SocCom.PubCod); - - /* End form */ Lay_PutRemoveButton (Txt_Remove); Act_FormEnd (); }