diff --git a/css/swad18.85.1.css b/css/swad18.87.css similarity index 99% rename from css/swad18.85.1.css rename to css/swad18.87.css index 44883d17..107323ec 100644 --- a/css/swad18.85.1.css +++ b/css/swad18.87.css @@ -1456,6 +1456,16 @@ a:hover /* Default ==> underlined */ } /********************************** Notice ***********************************/ +.NOTICE_HIGHLIGHT + { + padding:10px 0; + background-color:#ddecf1; + animation: fadein 2s linear forwards; + } +@keyframes fadein + { + to {background-color:white;} + } .NOTICE_CONTAINER_ACTIVE { box-sizing:border-box; diff --git a/swad_action.c b/swad_action.c index ba1a46cd..fb625ccb 100644 --- a/swad_action.c +++ b/swad_action.c @@ -2876,7 +2876,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActRevAnn */{1471,-1,TabUnk,ActSeeAnn ,0x200,0x200,0x200,0x200,0x200,0x200,0x200,Act_CONT_NORM,Act_BRW_1ST_TAB,Ann_RevealHiddenAnnouncement ,Ann_ShowAllAnnouncements ,NULL}, /* ActRemAnn */{1236,-1,TabUnk,ActSeeAnn ,0x200,0x200,0x200,0x200,0x200,0x200,0x200,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Ann_RemoveAnnouncement ,NULL}, - /* ActSeeOneNot */{1164,-1,TabUnk,ActSeeAllNot ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Not_GetNotCodToHighlight ,Not_ListFullNotices ,NULL}, + /* ActSeeOneNot */{1164,-1,TabUnk,ActSeeAllNot ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Not_GetHighLightedNotCod ,Not_ListFullNotices ,NULL}, /* ActWriNot */{ 59,-1,TabUnk,ActSeeAllNot ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Not_ShowFormNotice ,NULL}, /* ActRcvNot */{ 60,-1,TabUnk,ActSeeAllNot ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Not_ReceiveNotice ,Not_ListFullNotices ,NULL}, /* ActHidNot */{ 763,-1,TabUnk,ActSeeAllNot ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Not_HideActiveNotice ,Not_ListFullNotices ,NULL}, diff --git a/swad_changelog.h b/swad_changelog.h index 78482383..342a8026 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -446,8 +446,6 @@ Lo de mutear anuncios, en principio prefiero hacer una opci // TODO: Change in usability of Announcements of exams, suggested by Javier Fernández Baldomero. // TODO: Al pulsar sobre una convocatoria de examen / aviso --> ir a la sección de esa convocatoria/aviso en lugar de mostrarlo repetido y destacado arriba -// TODO: Los usuarios que no tienes permiso para ver su perfil público, se debería mostrar algo, una mínima ficha sin tinmeline o algo así - // TODO: Allow timeline posting only for users belonging to courses or admins to avoid user who create accounts only to post // TODO: Ver cómo recibir un fichero desde el cliente (SWADroid) en gsoap @@ -471,10 +469,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.86.3 (2019-03-24)" -#define CSS_FILE "swad18.85.1.css" +#define Log_PLATFORM_VERSION "SWAD 18.87 (2019-03-24)" +#define CSS_FILE "swad18.87.css" #define JS_FILE "swad18.85.js" /* + Version 18.87: Mar 24, 2019 Change in usability of notices. (240997 lines) Version 18.86.3: Mar 24, 2019 Optimization in suggestion of users to follow. (240965 lines) Version 18.86.2: Mar 24, 2019 Optimization in suggestion of users to follow. (240935 lines) Version 18.86.1: Mar 23, 2019 Changes in writing of a floating point number. diff --git a/swad_global.h b/swad_global.h index 44a699cb..0b093f69 100644 --- a/swad_global.h +++ b/swad_global.h @@ -505,7 +505,7 @@ struct Globals } Records; struct { - long NotCod; // Notice to be edited, removed... + long NotCod; // Notice to be edited, removed... used as parameter long HighlightNotCod; // Notice code of a notice to be highlighted } Notices; } CurrentCrs; diff --git a/swad_layout.c b/swad_layout.c index 09c4329b..9182e52d 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1006,7 +1006,8 @@ static void Lay_ShowLeftColumn (void) if (Gbl.CurrentCrs.Crs.CrsCod > 0) { fprintf (Gbl.F.Out,"
"); - Not_ShowNotices (Not_LIST_BRIEF_NOTICES); + Not_ShowNotices (Not_LIST_BRIEF_NOTICES, + -1L); // No notice highlighted fprintf (Gbl.F.Out,"
"); } @@ -1020,8 +1021,8 @@ static void Lay_ShowLeftColumn (void) static void Lay_ShowRightColumn (void) { extern const char *Txt_If_you_have_an_Android_device_try_SWADroid; - struct timeval tv1,tv2; - long tv_usecs; + // struct timeval tv1,tv2; + // long tv_usecs; /***** Banners *****/ Ban_WriteMenuWithBanners (); @@ -1046,12 +1047,13 @@ static void Lay_ShowRightColumn (void) } else if (Gbl.Usrs.Me.Logged) // I am logged { + /* gettimeofday (&tv1,NULL); - + */ /***** Suggest one user to follow *****/ fprintf (Gbl.F.Out,"
"); Fol_SuggestUsrsToFollowMainZoneOnRightColumn (); - + /* gettimeofday (&tv2,NULL); tv_usecs = (tv2.tv_sec - tv1.tv_sec ) * 1E6 + (tv2.tv_usec - tv1.tv_usec); @@ -1062,7 +1064,7 @@ static void Lay_ShowRightColumn (void) " VALUES" " (NOW(),'Fol_SuggestUsrsToFollowMainZoneOnRightColumn: %ld us')", tv_usecs); - + */ fprintf (Gbl.F.Out,"
"); } @@ -1241,6 +1243,20 @@ void Lay_EndSection (void) fprintf (Gbl.F.Out,""); } +/*****************************************************************************/ +/****************************** Start/end article ****************************/ +/*****************************************************************************/ + +void Lay_StartArticle (const char *ArticleId) + { + fprintf (Gbl.F.Out,"
",ArticleId); + } + +void Lay_EndArticle (void) + { + fprintf (Gbl.F.Out,"
"); + } + /*****************************************************************************/ /********** Write error message and exit when not enough memory **************/ /*****************************************************************************/ diff --git a/swad_layout.h b/swad_layout.h index 880acc86..176b75e2 100644 --- a/swad_layout.h +++ b/swad_layout.h @@ -74,6 +74,9 @@ void Lay_PutContextualCheckbox (Act_Action_t NextAction, void Lay_StartSection (const char *SectionId); void Lay_EndSection (void); +void Lay_StartArticle (const char *ArticleId); +void Lay_EndArticle (void); + void Lay_NotEnoughMemoryExit (void); void Lay_WrongScopeExit (void); void Lay_NoPermissionExit (void); diff --git a/swad_notice.c b/swad_notice.c index b165983b..91fab470 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -74,7 +74,7 @@ static void Not_PutIconToAddNewNotice (void); static void Not_PutButtonToAddNewNotice (void); static void Not_GetDataAndShowNotice (long NotCod); static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, - long NotCod, + long NotCod,bool Highlight, time_t TimeUTC, const char *Content, long UsrCod, @@ -118,7 +118,8 @@ void Not_ShowFormNotice (void) Frm_EndForm (); /***** Show all notices *****/ - Not_ShowNotices (Not_LIST_FULL_NOTICES); + Not_ShowNotices (Not_LIST_FULL_NOTICES, + -1L); // No notice highlighted } /*****************************************************************************/ @@ -152,6 +153,9 @@ void Not_ReceiveNotice (void) /***** Create a new social note about the new notice *****/ TL_StoreAndPublishNote (TL_NOTE_NOTICE,NotCod,&SocPub); + + /***** Set notice to be highlighted *****/ + Gbl.CurrentCrs.Notices.HighlightNotCod = NotCod; } /*****************************************************************************/ @@ -206,12 +210,19 @@ void Not_ListNoticesAfterRemoval (void) void Not_ListFullNotices (void) { - /***** Show highlighted notice *****/ - if (Gbl.CurrentCrs.Notices.HighlightNotCod > 0) - Not_GetDataAndShowNotice (Gbl.CurrentCrs.Notices.HighlightNotCod); - /***** Show all notices *****/ - Not_ShowNotices (Not_LIST_FULL_NOTICES); + Not_ShowNotices (Not_LIST_FULL_NOTICES, + Gbl.CurrentCrs.Notices.HighlightNotCod); // Highlight notice + } + +/*****************************************************************************/ +/************************* Get highlighted notice code ***********************/ +/*****************************************************************************/ + +void Not_GetHighLightedNotCod (void) + { + /***** Get notice to be highlighted *****/ + Gbl.CurrentCrs.Notices.HighlightNotCod = Not_GetParamNotCod (); } /*****************************************************************************/ @@ -234,6 +245,9 @@ void Not_HideActiveNotice (void) /***** Update RSS of current course *****/ RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs); + + /***** Set notice to be highlighted *****/ + Gbl.CurrentCrs.Notices.HighlightNotCod = NotCod; } /*****************************************************************************/ @@ -256,6 +270,9 @@ void Not_RevealHiddenNotice (void) /***** Update RSS of current course *****/ RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs); + + /***** Set notice to be highlighted *****/ + Gbl.CurrentCrs.Notices.HighlightNotCod = NotCod; } /*****************************************************************************/ @@ -266,23 +283,26 @@ void Not_RequestRemNotice (void) { extern const char *Txt_Do_you_really_want_to_remove_the_following_notice; extern const char *Txt_Remove; + long NotCod; /***** Get the code of the notice to remove *****/ - Gbl.CurrentCrs.Notices.NotCod = Not_GetParamNotCod (); + NotCod = Not_GetParamNotCod (); /***** Show question and button to remove this notice *****/ /* Start alert */ Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_following_notice); /* Show notice */ - Not_GetDataAndShowNotice (Gbl.CurrentCrs.Notices.NotCod); + Not_GetDataAndShowNotice (NotCod); /* End alert */ + Gbl.CurrentCrs.Notices.NotCod = NotCod; // To put parameters Ale_ShowAlertAndButton2 (ActRemNot,NULL,NULL,Not_PutParams, Btn_REMOVE_BUTTON,Txt_Remove); /***** Show all notices *****/ - Not_ShowNotices (Not_LIST_FULL_NOTICES); + Not_ShowNotices (Not_LIST_FULL_NOTICES, + NotCod); // Highlight notice to be removed } /*****************************************************************************/ @@ -322,24 +342,13 @@ void Not_RemoveNotice (void) RSS_UpdateRSSFileForACrs (&Gbl.CurrentCrs.Crs); } -/*****************************************************************************/ -/********************* Get notice to show highlighted ************************/ -/*****************************************************************************/ - -void Not_GetNotCodToHighlight (void) - { - /***** Get the code of the notice to highlight *****/ - Gbl.CurrentCrs.Notices.HighlightNotCod = Not_GetParamNotCod (); - } - /*****************************************************************************/ /***************************** Show the notices ******************************/ /*****************************************************************************/ -void Not_ShowNotices (Not_Listing_t TypeNoticesListing) +void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod) { extern const char *Hlp_MESSAGES_Notices; - extern const char *Txt_All_notices; extern const char *Txt_Notices; extern const char *Txt_No_notices; MYSQL_RES *mysql_res; @@ -395,8 +404,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing) "%upx", Not_ContainerWidth[Not_LIST_FULL_NOTICES] + 50); Box_StartBox (StrWidth, - Gbl.CurrentCrs.Notices.HighlightNotCod > 0 ? Txt_All_notices : - Txt_Notices, + Txt_Notices, Not_PutIconsListNotices, Hlp_MESSAGES_Notices,Box_NOT_CLOSABLE); if (!NumNotices) @@ -437,6 +445,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing) /* Draw the notice */ Not_DrawANotice (TypeNoticesListing, NotCod, + (NotCod == HighlightNotCod), // Highlighted? TimeUTC,Content,UsrCod,Status); } @@ -581,6 +590,7 @@ static void Not_GetDataAndShowNotice (long NotCod) /***** Draw the notice *****/ Not_DrawANotice (Not_LIST_FULL_NOTICES, NotCod, + false, // Not highlighted TimeUTC,Content,UsrCod,Status); } @@ -593,7 +603,7 @@ static void Not_GetDataAndShowNotice (long NotCod) /*****************************************************************************/ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, - long NotCod, + long NotCod,bool Highlight, time_t TimeUTC, const char *Content, long UsrCod, @@ -627,8 +637,19 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, }; static unsigned UniqueId = 0; struct UsrData UsrDat; + char Anchor[16 + 10 + 1]; - Gbl.CurrentCrs.Notices.NotCod = NotCod; // Parameter for forms + /***** Build anchor string *****/ + snprintf (Anchor,sizeof (Anchor), + "NOT_%ld",NotCod); + + /***** Start article for this notice *****/ + if (TypeNoticesListing == Not_LIST_FULL_NOTICES) + { + Lay_StartArticle (Anchor); + if (Highlight) + fprintf (Gbl.F.Out,"
"); + } /***** Start yellow note *****/ fprintf (Gbl.F.Out,"
", @@ -641,6 +662,8 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, { if (Not_CheckIfICanEditNotices ()) { + Gbl.CurrentCrs.Notices.NotCod = NotCod; // To put parameters + /***** Put form to remove announcement *****/ Ico_PutContextualIconToRemove (ActReqRemNot,Not_PutParams); @@ -648,12 +671,12 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, switch (Status) { case Not_ACTIVE_NOTICE: - Lay_PutContextualLinkOnlyIcon (ActHidNot,NULL,Not_PutParams, + Lay_PutContextualLinkOnlyIcon (ActHidNot,Anchor,Not_PutParams, "eye.svg", Txt_NOTICE_Active_Mark_as_obsolete); break; case Not_OBSOLETE_NOTICE: - Lay_PutContextualLinkOnlyIcon (ActRevNot,NULL,Not_PutParams, + Lay_PutContextualLinkOnlyIcon (ActRevNot,Anchor,Not_PutParams, "eye-slash.svg", Txt_NOTICE_Obsolete_Mark_as_active); break; @@ -696,7 +719,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, if (TypeNoticesListing == Not_LIST_BRIEF_NOTICES) { /* Form to view full notice */ - Frm_StartForm (ActSeeOneNot); + Frm_StartFormAnchor (ActSeeOneNot,Anchor); Not_PutHiddenParamNotCod (NotCod); Frm_LinkFormSubmit (Txt_See_full_notice,DateClass[Status],NULL); } @@ -722,7 +745,8 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, /* Put form to view full notice */ fprintf (Gbl.F.Out,"
"); - Lay_PutContextualLinkOnlyIcon (ActSeeOneNot,NULL,Not_PutParams, + Gbl.CurrentCrs.Notices.NotCod = NotCod; // To put parameters + Lay_PutContextualLinkOnlyIcon (ActSeeOneNot,Anchor,Not_PutParams, "ellipsis-h.svg", Txt_See_full_notice); fprintf (Gbl.F.Out,"
"); @@ -743,6 +767,14 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, /***** End yellow note *****/ fprintf (Gbl.F.Out,"
"); + + /***** End article for this notice *****/ + if (TypeNoticesListing == Not_LIST_FULL_NOTICES) + { + if (Highlight) + fprintf (Gbl.F.Out,"
"); + Lay_EndArticle (); + } } /*****************************************************************************/ @@ -1011,11 +1043,6 @@ void Not_PutHiddenParamNotCod (long NotCod) static long Not_GetParamNotCod (void) { - long NotCod; - /***** Get notice code *****/ - if ((NotCod = Par_GetParToLong ("NotCod")) <= 0) - Lay_ShowErrorAndExit ("Wrong code of notice."); - - return NotCod; + return Par_GetParToLong ("NotCod"); } diff --git a/swad_notice.h b/swad_notice.h index 4ffb01d9..398170fc 100644 --- a/swad_notice.h +++ b/swad_notice.h @@ -59,6 +59,7 @@ void Not_ShowFormNotice (void); void Not_ReceiveNotice (void); void Not_ListNoticesAfterRemoval (void); void Not_ListFullNotices (void); +void Not_GetHighLightedNotCod (void); void Not_HideActiveNotice (void); void Not_RevealHiddenNotice (void); @@ -66,8 +67,7 @@ void Not_RevealHiddenNotice (void); void Not_RequestRemNotice (void); void Not_RemoveNotice (void); -void Not_GetNotCodToHighlight (void); -void Not_ShowNotices (Not_Listing_t TypeNoticesListing); +void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod); void Not_GetSummaryAndContentNotice (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], char **ContentStr, long NotCod,bool GetContent); diff --git a/swad_text.c b/swad_text.c index b1caec63..03e0cc3c 100644 --- a/swad_text.c +++ b/swad_text.c @@ -1295,27 +1295,6 @@ const char *Txt_All_groups = "Todos os grupos"; #endif -const char *Txt_All_notices = -#if L==1 // ca - "Tots els avisos"; -#elif L==2 // de - "Alle Ankündigungen"; -#elif L==3 // en - "All notices"; -#elif L==4 // es - "Todos los avisos"; -#elif L==5 // fr - "Tous les avis"; -#elif L==6 // gn - "Todos los avisos"; // Okoteve traducción -#elif L==7 // it - "Tutti i avvisi"; -#elif L==8 // pl - "Wszystkie ogloszenia"; -#elif L==9 // pt - "Todos os avisos"; -#endif - const char *Txt_All_places = #if L==1 // ca "Tots els llocs";