From fec29d76a2913c472eba0e44d515bf06ac92d95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 6 Dec 2016 18:04:12 +0100 Subject: [PATCH] Version 16.89 --- swad_agenda.c | 58 +++++++++++++++++++++++++++----------------- swad_changelog.h | 3 ++- swad_file_browser.c | 2 +- swad_layout.c | 59 +++++++++++++++++++++++++++++++-------------- swad_layout.h | 8 +++++- swad_text.c | 21 ---------------- swad_zip.c | 2 +- 7 files changed, 88 insertions(+), 65 deletions(-) diff --git a/swad_agenda.c b/swad_agenda.c index 7b005b185..3e9bf797a 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -58,9 +58,9 @@ extern struct Globals Gbl; #define Agd_NUM_AGENDA_TYPES 4 typedef enum { - Agd_USR_AGENDA_NOW, + Agd_USR_AGENDA_TODAY, Agd_USR_AGENDA, - Agd_MY_AGENDA_NOW, + Agd_MY_AGENDA_TODAY, Agd_MY_AGENDA, } Agd_AgendaType_t; @@ -147,7 +147,7 @@ void Agd_ShowUsrAgendaAfterLogIn (void) Hlp_PROFILE_Agenda); // TODO: Change /***** Show the current events in the user's agenda *****/ - Agd_ShowEventsNow (Agd_USR_AGENDA_NOW); + Agd_ShowEventsNow (Agd_USR_AGENDA_TODAY); /***** Show all the visible events in the user's agenda *****/ Agd_ShowEvents (Agd_USR_AGENDA); @@ -188,7 +188,7 @@ void Agd_ShowUsrAgenda (void) Hlp_PROFILE_Agenda); // TODO: Change /***** Show the current events in the user's agenda *****/ - Agd_ShowEventsNow (Agd_USR_AGENDA_NOW); + Agd_ShowEventsNow (Agd_USR_AGENDA_TODAY); /***** Show all the visible events in the user's agenda *****/ Agd_ShowEvents (Agd_USR_AGENDA); @@ -237,8 +237,7 @@ void Agd_ShowMyAgenda (void) Act_FormEnd (); /***** Show the current events in the user's agenda *****/ - if (Gbl.Agenda.WhichEvents == Agd_ONLY_PUBLIC_EVENTS) - Agd_ShowEventsNow (Agd_MY_AGENDA_NOW); + Agd_ShowEventsNow (Agd_MY_AGENDA_TODAY); /***** Show all my events *****/ Agd_ShowEvents (Agd_MY_AGENDA); @@ -323,7 +322,7 @@ static void Agd_ShowEvents (Agd_AgendaType_t AgendaType) static void Agd_ShowEventsNow (Agd_AgendaType_t AgendaType) { extern const char *Hlp_PROFILE_Agenda; - extern const char *Txt_Now; + extern const char *Txt_Today; extern const char *Txt_Public_agenda_USER; extern const char *Txt_My_agenda; extern const char *Txt_No_events; @@ -338,9 +337,9 @@ static void Agd_ShowEventsNow (Agd_AgendaType_t AgendaType) if (Gbl.Agenda.Num) { /***** Start frame *****/ - Lay_StartRoundFrameTable (NULL,Txt_Now, - NULL, - Hlp_PROFILE_Agenda,2); // TODO: Change + Lay_StartRoundFrameTableShadow (NULL,Txt_Today, + NULL, + Hlp_PROFILE_Agenda,2); // TODO: Change /***** Table head *****/ Agd_WriteHeaderListEvents (AgendaType); @@ -380,12 +379,12 @@ static void Agd_WriteHeaderListEvents (Agd_AgendaType_t AgendaType) fprintf (Gbl.F.Out,""); switch (AgendaType) { - case Agd_USR_AGENDA_NOW: + case Agd_USR_AGENDA_TODAY: case Agd_USR_AGENDA: Act_FormStart (ActSeeUsrAgd); Usr_PutParamOtherUsrCodEncrypted (); break; - case Agd_MY_AGENDA_NOW: + case Agd_MY_AGENDA_TODAY: case Agd_MY_AGENDA: Act_FormStart (ActSeeMyAgd); break; @@ -578,11 +577,11 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod) AgdEvent.AgdCod = AgdCod; switch (AgendaType) { - case Agd_USR_AGENDA_NOW: + case Agd_USR_AGENDA_TODAY: case Agd_USR_AGENDA: AgdEvent.UsrCod = Gbl.Usrs.Other.UsrDat.UsrCod; break; - case Agd_MY_AGENDA_NOW: + case Agd_MY_AGENDA_TODAY: case Agd_MY_AGENDA: AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; break; @@ -849,10 +848,11 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType) } switch (AgendaType) { - case Agd_USR_AGENDA_NOW: + case Agd_USR_AGENDA_TODAY: sprintf (Query,"SELECT AgdCod FROM agendas" " WHERE UsrCod='%ld' AND Public='Y' AND Hidden='N'" - " AND StartTime<=NOW() AND EndTime>=NOW()" // Only present events + " AND DATE(StartTime)<=CURDATE()" + " AND DATE(EndTime)>=CURDATE()" // Only today events " ORDER BY %s", Gbl.Usrs.Other.UsrDat.UsrCod,OrderBySubQuery); break; @@ -863,12 +863,26 @@ static void Agd_GetListEvents (Agd_AgendaType_t AgendaType) " ORDER BY %s", Gbl.Usrs.Other.UsrDat.UsrCod,OrderBySubQuery); break; - case Agd_MY_AGENDA_NOW: - sprintf (Query,"SELECT AgdCod FROM agendas" - " WHERE UsrCod='%ld' AND Public='Y' AND Hidden='N'" - " AND StartTime<=NOW() AND EndTime>=NOW()" // Only present events - " ORDER BY %s", - Gbl.Usrs.Me.UsrDat.UsrCod,OrderBySubQuery); + case Agd_MY_AGENDA_TODAY: + switch (Gbl.Agenda.WhichEvents) + { + case Agd_ALL_EVENTS: + sprintf (Query,"SELECT AgdCod FROM agendas" + " WHERE UsrCod='%ld'" + " AND DATE(StartTime)<=CURDATE()" + " AND DATE(EndTime)>=CURDATE()" // Only today events + " ORDER BY %s", + Gbl.Usrs.Me.UsrDat.UsrCod,OrderBySubQuery); + break; + case Agd_ONLY_PUBLIC_EVENTS: + sprintf (Query,"SELECT AgdCod FROM agendas" + " WHERE UsrCod='%ld' AND Public='Y' AND Hidden='N'" + " AND DATE(StartTime)<=CURDATE()" + " AND DATE(EndTime)>=CURDATE()" // Only today events + " ORDER BY %s", + Gbl.Usrs.Me.UsrDat.UsrCod,OrderBySubQuery); + break; + } break; case Agd_MY_AGENDA: switch (Gbl.Agenda.WhichEvents) diff --git a/swad_changelog.h b/swad_changelog.h index a5527eb82..e3de1b123 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -183,13 +183,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.88.1 (2016-12-06)" +#define Log_PLATFORM_VERSION "SWAD 16.89 (2016-12-06)" #define CSS_FILE "swad16.86.5.css" #define JS_FILE "swad16.84.2.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.89: Dec 06, 2016 Agenda events now are replaced by agenda events today. (210139 lines) Version 16.88.1: Dec 06, 2016 Fixed bugs in agenda. (210118 lines) Version 16.88: Dec 06, 2016 Current events in user's agenda are displayed in a highlighted box. (210102 lines) Version 16.87.2: Dec 05, 2016 Icon to edit my agenda. (209987 lines) diff --git a/swad_file_browser.c b/swad_file_browser.c index 2ceb82cc9..707c9c813 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -9304,7 +9304,7 @@ void Brw_ShowFileMetadata (void) } /***** Start frame *****/ - Lay_StartRoundFrameTableShadow (NULL,2); + Lay_StartRoundFrameTableShadow (NULL,NULL,NULL,NULL,2); /***** Link to download the file *****/ fprintf (Gbl.F.Out,"" diff --git a/swad_layout.c b/swad_layout.c index a781c8127..e5240b4f7 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -95,6 +95,11 @@ static void Lay_WriteTitleAction (void); static void Lay_ShowLeftColumn (void); static void Lay_ShowRightColumn (void); +static void Lay_StartRoundFrameInternal (const char *Width,const char *Title, + void (*FunctionToDrawContextualIcons) (void), + const char *HelpLink, + const char *ClassFrame); + static void Lay_WriteAboutZone (void); static void Lay_WriteFootFromHTMLFile (void); @@ -1316,17 +1321,51 @@ void Lay_StartRoundFrameTable (const char *Width,const char *Title, fprintf (Gbl.F.Out,"\">"); } +void Lay_StartRoundFrameTableShadow (const char *Width,const char *Title, + void (*FunctionToDrawContextualIcons) (void), + const char *HelpLink, + unsigned CellPadding) + { + Lay_StartRoundFrameShadow (Width,Title,FunctionToDrawContextualIcons,HelpLink); + + fprintf (Gbl.F.Out,""); + } + void Lay_StartRoundFrame (const char *Width,const char *Title, void (*FunctionToDrawContextualIcons) (void), const char *HelpLink) + { + Lay_StartRoundFrameInternal (Width,Title, + FunctionToDrawContextualIcons, + HelpLink, + "FRAME"); + } + +void Lay_StartRoundFrameShadow (const char *Width,const char *Title, + void (*FunctionToDrawContextualIcons) (void), + const char *HelpLink) + { + Lay_StartRoundFrameInternal (Width,Title, + FunctionToDrawContextualIcons, + HelpLink, + "FRAME_SHADOW"); + } + +static void Lay_StartRoundFrameInternal (const char *Width,const char *Title, + void (*FunctionToDrawContextualIcons) (void), + const char *HelpLink, + const char *ClassFrame) { extern const char *Txt_Help; fprintf (Gbl.F.Out,"
" - "
"); fprintf (Gbl.F.Out,"
"); @@ -1362,22 +1401,6 @@ void Lay_StartRoundFrame (const char *Width,const char *Title, Gbl.Layout.FrameNested++; } -// CellPadding must be 0, 1, 2, 4 or 8 - -void Lay_StartRoundFrameTableShadow (const char *Width,unsigned CellPadding) - { - fprintf (Gbl.F.Out,"
" - "
" - "
"); - } - void Lay_EndRoundFrameTable (void) { fprintf (Gbl.F.Out,"
"); diff --git a/swad_layout.h b/swad_layout.h index 5cca85033..40e54918a 100644 --- a/swad_layout.h +++ b/swad_layout.h @@ -105,7 +105,13 @@ void Lay_StartRoundFrameTable (const char *Width,const char *Title, void Lay_StartRoundFrame (const char *Width,const char *Title, void (*FunctionToDrawContextualIcons) (void), const char *HelpLink); -void Lay_StartRoundFrameTableShadow (const char *Width,unsigned CellPadding); +void Lay_StartRoundFrameShadow (const char *Width,const char *Title, + void (*FunctionToDrawContextualIcons) (void), + const char *HelpLink); +void Lay_StartRoundFrameTableShadow (const char *Width,const char *Title, + void (*FunctionToDrawContextualIcons) (void), + const char *HelpLink, + unsigned CellPadding); void Lay_EndRoundFrameTable (void); void Lay_EndRoundFrameTableWithButton (Lay_Button_t Button,const char *TxtButton); void Lay_EndRoundFrameWithButton (Lay_Button_t Button,const char *TxtButton); diff --git a/swad_text.c b/swad_text.c index 5da8ab4a1..b58b359fe 100644 --- a/swad_text.c +++ b/swad_text.c @@ -26868,27 +26868,6 @@ const char *Txt_Notify_me_BR_by_email = "Notifique-me
por email"; #endif -const char *Txt_Now = -#if L==1 - "Ara"; -#elif L==2 - "Jetzt"; -#elif L==3 - "Now"; -#elif L==4 - "Ahora"; -#elif L==5 - "Maintenant"; -#elif L==6 - "Ko'ãga"; -#elif L==7 - "Ora"; -#elif L==8 - "Teraz"; -#elif L==9 - "Agora"; -#endif - const char *Txt_Now_each_student_can_belong_to_multiple_groups_of_type_X = // Warning: it is very important to include %s in the following sentences #if L==1 "Ahora cada estudiante puede pertenecer a varios grupos de tipo %s."; // Necessita traduccio diff --git a/swad_zip.c b/swad_zip.c index fffe71acf..929b25a7c 100644 --- a/swad_zip.c +++ b/swad_zip.c @@ -617,7 +617,7 @@ static void ZIP_ShowLinkToDownloadZIP (const char *FileName,const char *URL, Str_LimitLengthHTMLStr (FileNameShort,50); /***** Start frame *****/ - Lay_StartRoundFrameTableShadow (NULL,2); + Lay_StartRoundFrameTableShadow (NULL,NULL,NULL,NULL,2); /***** Link to download the file *****/ fprintf (Gbl.F.Out,""