From 05fead7907c0113e2dc93f71dbeb55300e44f679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 21 Mar 2016 15:10:00 +0100 Subject: [PATCH] Version 15.159.1 --- swad_changelog.h | 5 ++-- swad_notice.c | 68 +++++++++++++++++++++++++----------------------- swad_notice.h | 2 +- swad_text.c | 23 +++++++++++++++- 4 files changed, 62 insertions(+), 36 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 8c360375a..a94ffe05c 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -134,14 +134,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.158.5 (2016-03-21)" +#define Log_PLATFORM_VERSION "SWAD 15.159.1 (2016-03-21)" #define CSS_FILE "swad15.157.css" #define JS_FILE "swad15.131.3.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 15.158.5: Mar 21, 2016 Number of sent/received messages integrated in frame title. (? lines) + Version 15.159.1: Mar 21, 2016 Icon to add new notice integrated in frame. (196395 lines) + Version 15.159: Mar 21, 2016 Number of sent/received messages integrated in frame title. (196372 lines) Version 15.158.4: Mar 21, 2016 Icon to remove sent/received messages integrated in frame. (196300 lines) Version 15.158.3: Mar 21, 2016 Change in layout of form to import test questions. (196277 lines) Version 15.158.2: Mar 21, 2016 Icon to add new test question integrated in frame. (196283 lines) diff --git a/swad_notice.c b/swad_notice.c index b23a1bc06..8bcc4ae1f 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -66,14 +66,15 @@ const unsigned Not_MaxCharsURLOnScreen[Not_NUM_TYPES_LISTING] = /***************************** Private prototypes ****************************/ /*****************************************************************************/ -static void Not_GetDataAndShowNotice (long NotCod,bool ICanEditNotices); +static void Not_PutIconToAddNewNotice (void); +static void Not_GetDataAndShowNotice (long NotCod,bool ICanEdit); static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, long NotCod, time_t TimeUTC, const char *Content, long UsrCod, Not_Status_t Status, - bool ICanEditNotices); + bool ICanEdit); static long Not_InsertNoticeInDB (const char *Content); static void Not_UpdateNumUsrsNotifiedByEMailAboutNotice (long NotCod,unsigned NumUsrsToBeNotifiedByEMail); static long Not_GetParamNotCod (void); @@ -210,24 +211,15 @@ void Not_ListNoticesAfterRemoval (void) void Not_ListFullNotices (void) { - extern const char *Txt_New_notice; - bool ICanEditNotices = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || - Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); - - if (ICanEditNotices) - { - fprintf (Gbl.F.Out,"
"); - Lay_PutContextualLink (ActWriNot,NULL,"plus64x64.png", - Txt_New_notice,Txt_New_notice); - fprintf (Gbl.F.Out,"
"); - } + bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || + Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); /***** Show highlighted notice *****/ if (Gbl.CurrentCrs.Notices.HighlightNotCod > 0) - Not_GetDataAndShowNotice (Gbl.CurrentCrs.Notices.HighlightNotCod,ICanEditNotices); + Not_GetDataAndShowNotice (Gbl.CurrentCrs.Notices.HighlightNotCod,ICanEdit); /***** Show all notices *****/ - Not_ShowNotices (Not_LIST_FULL_NOTICES,ICanEditNotices); + Not_ShowNotices (Not_LIST_FULL_NOTICES,ICanEdit); } /*****************************************************************************/ @@ -354,9 +346,10 @@ void Not_GetNotToShowHighlighted (void) /***************************** Show the notices ******************************/ /*****************************************************************************/ -void Not_ShowNotices (Not_Listing_t TypeNoticesListing,bool ICanEditNotices) +void Not_ShowNotices (Not_Listing_t TypeNoticesListing,bool ICanEdit) { extern const char *Txt_All_notices; + extern const char *Txt_Notices; extern const char *Txt_No_notices; char Query[512]; MYSQL_RES *mysql_res; @@ -398,14 +391,15 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,bool ICanEditNotices) if (TypeNoticesListing == Not_LIST_FULL_NOTICES) { - if (NumNotices) - { - /***** Start frame *****/ - sprintf (StrWidth,"%upx", - Not_ContainerWidth[Not_LIST_FULL_NOTICES] + 50); - Lay_StartRoundFrame (StrWidth,Txt_All_notices,NULL); - } - else + /***** Start frame *****/ + sprintf (StrWidth,"%upx", + Not_ContainerWidth[Not_LIST_FULL_NOTICES] + 50); + Lay_StartRoundFrame (StrWidth, + Gbl.CurrentCrs.Notices.HighlightNotCod > 0 ? Txt_All_notices : + Txt_Notices, + ICanEdit ? Not_PutIconToAddNewNotice : + NULL); + if (!NumNotices) Lay_ShowAlert (Lay_INFO,Txt_No_notices); } @@ -443,7 +437,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,bool ICanEditNotices) Not_DrawANotice (TypeNoticesListing, NotCod, TimeUTC,Content,UsrCod,Status, - ICanEditNotices); + ICanEdit); } switch (TypeNoticesListing) @@ -469,9 +463,8 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,bool ICanEditNotices) Gbl.Prefs.IconsURL); break; case Not_LIST_FULL_NOTICES: - if (NumNotices) - /***** End frame *****/ - Lay_EndRoundFrame (); + /***** End frame *****/ + Lay_EndRoundFrame (); break; } @@ -485,11 +478,22 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,bool ICanEditNotices) } } +/*****************************************************************************/ +/*********************** Put icon to add a new notice ************************/ +/*****************************************************************************/ + +static void Not_PutIconToAddNewNotice (void) + { + extern const char *Txt_New_notice; + + Lay_PutContextualLink (ActWriNot,NULL,"plus64x64.png",Txt_New_notice,NULL); + } + /*****************************************************************************/ /******************** Get data of a notice and show it ***********************/ /*****************************************************************************/ -static void Not_GetDataAndShowNotice (long NotCod,bool ICanEditNotices) +static void Not_GetDataAndShowNotice (long NotCod,bool ICanEdit) { char Query[512]; MYSQL_RES *mysql_res; @@ -531,7 +535,7 @@ static void Not_GetDataAndShowNotice (long NotCod,bool ICanEditNotices) Not_DrawANotice (Not_LIST_FULL_NOTICES, NotCod, TimeUTC,Content,UsrCod,Status, - ICanEditNotices); + ICanEdit); } /***** Free structure that stores the query result *****/ @@ -548,7 +552,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, const char *Content, long UsrCod, Not_Status_t Status, - bool ICanEditNotices) + bool ICanEdit) { extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *Txt_NOTICE_Active_SINGULAR; @@ -590,7 +594,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, /* Write symbol to indicate if notice is obsolete or active */ if (TypeNoticesListing == Not_LIST_FULL_NOTICES) { - if (ICanEditNotices) + if (ICanEdit) { /* Form to remove notice */ Act_FormStart (ActReqRemNot); diff --git a/swad_notice.h b/swad_notice.h index 32b1b0bc9..04945551d 100644 --- a/swad_notice.h +++ b/swad_notice.h @@ -67,7 +67,7 @@ void Not_RequestRemNotice (void); void Not_RemoveNotice (void); void Not_GetNotToShowHighlighted (void); -void Not_ShowNotices (Not_Listing_t TypeNoticesListing,bool ICanEditNotices); +void Not_ShowNotices (Not_Listing_t TypeNoticesListing,bool ICanEdit); void Not_GetSummaryAndContentNotice (char *SummaryStr,char **ContentStr, long NotCod,unsigned MaxChars,bool GetContent); unsigned Not_GetNumNotices (Sco_Scope_t Scope,Not_Status_t Status,unsigned *NumNotif); diff --git a/swad_text.c b/swad_text.c index 24d834951..190240a0f 100644 --- a/swad_text.c +++ b/swad_text.c @@ -25033,6 +25033,27 @@ const char *Txt_Notice_removed = "Aviso removido."; #endif +const char *Txt_Notices = +#if L==1 + "Avisos"; +#elif L==2 + "Ankündigungen"; +#elif L==3 + "Notices"; +#elif L==4 + "Avisos"; +#elif L==5 + "Avis"; +#elif L==6 + "Marandu"; +#elif L==7 + "Avvisi"; +#elif L==8 + "Ogloszenia"; +#elif L==9 + "Avisos"; +#endif + const char *Txt_NOTIF_new_SINGULAR = #if L==1 "nueva"; // Necessita traduccio @@ -38017,7 +38038,7 @@ const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES] = #elif L==7 "Avvisi" #elif L==8 - "Notices" // Potrzebujesz tlumaczenie + "Ogloszenia" #elif L==9 "Avisos" #endif