From 4f7463ae71f7a2bf73f8e28fa1c1320e208a1105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 9 Feb 2017 14:32:19 +0100 Subject: [PATCH] Version 16.135.1 --- swad_calendar.c | 39 +++++++++++++++++++++++++-------------- swad_calendar.h | 1 + swad_changelog.h | 3 ++- swad_date.c | 3 ++- swad_layout.c | 6 ++++-- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/swad_calendar.c b/swad_calendar.c index 707785816..793036de0 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -190,7 +190,6 @@ void Cal_DrawCurrentMonth (void) { extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES]; char ParamsStr[256 + 256 + Ses_LENGTH_SESSION_ID + 256]; - Act_Action_t ActionSeeCalendar; /***** Get list of holidays *****/ if (!Gbl.Hlds.LstIsRead) @@ -213,25 +212,37 @@ void Cal_DrawCurrentMonth (void) Gbl.CurrentCtr.Ctr.PlcCod, Cfg_URL_SWAD_CGI, Txt_STR_LANG_ID[Gbl.Prefs.Language]); - if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected - ActionSeeCalendar = ActSeeCalCrs; - else if (Gbl.CurrentDeg.Deg.DegCod > 0) // Degree selected - ActionSeeCalendar = ActSeeCalDeg; - else if (Gbl.CurrentCtr.Ctr.CtrCod > 0) // Centre selected - ActionSeeCalendar = ActSeeCalCtr; - else if (Gbl.CurrentIns.Ins.InsCod > 0) // Institution selected - ActionSeeCalendar = ActSeeCalIns; - else if (Gbl.CurrentCty.Cty.CtyCod > 0) // Country selected - ActionSeeCalendar = ActSeeCalCty; - else - ActionSeeCalendar = ActSeeCalSys; - Act_SetParamsForm (ParamsStr,ActionSeeCalendar,true); + Act_SetParamsForm (ParamsStr,Cal_GetActionToSeeCalendar (),true); fprintf (Gbl.F.Out,"'%s',",ParamsStr); Act_SetParamsForm (ParamsStr,ActSeeDatExaAnn,true); fprintf (Gbl.F.Out,"'%s');" "",ParamsStr); } +/*****************************************************************************/ +/********** Get action to see calendar depending on current scope ************/ +/*****************************************************************************/ + +Act_Action_t Cal_GetActionToSeeCalendar () + { + if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected + return ActSeeCalCrs; + + if (Gbl.CurrentDeg.Deg.DegCod > 0) // Degree selected + return ActSeeCalDeg; + + if (Gbl.CurrentCtr.Ctr.CtrCod > 0) // Centre selected + return ActSeeCalCtr; + + if (Gbl.CurrentIns.Ins.InsCod > 0) // Institution selected + return ActSeeCalIns; + + if (Gbl.CurrentCty.Cty.CtyCod > 0) // Country selected + return ActSeeCalCty; + + return ActSeeCalSys; + } + /*****************************************************************************/ /************************ Draw an academic calendar **************************/ /*****************************************************************************/ diff --git a/swad_calendar.h b/swad_calendar.h index f11136a3a..ae0380087 100644 --- a/swad_calendar.h +++ b/swad_calendar.h @@ -49,6 +49,7 @@ void Cal_ShowFormToSelFirstDayOfWeek (Act_Action_t Action,void (*FuncParams) (), void Cal_ChangeFirstDayOfWeek (void); void Cal_DrawCurrentMonth (void); +Act_Action_t Cal_GetActionToSeeCalendar (); void Cal_DrawCalendarSys (void); void Cal_DrawCalendarCty (void); diff --git a/swad_changelog.h b/swad_changelog.h index 4d3939ec6..70a1372b8 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -196,13 +196,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.135 (2017-02-09)" +#define Log_PLATFORM_VERSION "SWAD 16.135.1 (2017-02-09)" #define CSS_FILE "swad16.135.css" #define JS_FILE "swad16.123.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.135.1: Feb 09, 2017 Link from current date to calendar depending on scope. (212461 lines) Version 16.135: Feb 09, 2017 Changes in layout of tabs. (212452 lines) Version 16.134.3: Feb 09, 2017 Changes in visible tabs depending on scope. (212451 lines) Version 16.134.2: Feb 09, 2017 Changed country, institution, centre and degree configuration icons. (212447 lines) diff --git a/swad_date.c b/swad_date.c index 16a63fd3a..5c19a076e 100644 --- a/swad_date.c +++ b/swad_date.c @@ -28,6 +28,7 @@ #include // For string functions #include // For time functions (mktime...) +#include "swad_calendar.h" #include "swad_config.h" #include "swad_database.h" #include "swad_date.h" @@ -169,7 +170,7 @@ void Dat_ShowClientLocalTime (void) /* Month with link to calendar */ fprintf (Gbl.F.Out,"
"); - Act_FormStart (ActSeeCalCrs); + Act_FormStart (Cal_GetActionToSeeCalendar ()); Act_LinkFormSubmit (Txt_Show_calendar,"CURRENT_MONTH",NULL); fprintf (Gbl.F.Out,"" // JavaScript will write HTML here "" diff --git a/swad_layout.c b/swad_layout.c index 6b7fd2be1..2010c4a08 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -491,8 +491,10 @@ static void Lay_WriteScripts (void) /***** Prepare script to draw months *****/ if ((Gbl.Prefs.SideCols & Lay_SHOW_LEFT_COLUMN) || // Left column visible - Gbl.Action.Act == ActSeeCalCrs || - Gbl.Action.Act == ActPrnCalCrs) + Gbl.Action.Act == ActSeeCalIns || Gbl.Action.Act == ActPrnCalIns || + Gbl.Action.Act == ActSeeCalCtr || Gbl.Action.Act == ActPrnCalCtr || + Gbl.Action.Act == ActSeeCalDeg || Gbl.Action.Act == ActPrnCalDeg || + Gbl.Action.Act == ActSeeCalCrs || Gbl.Action.Act == ActPrnCalCrs) { /***** Get list of holidays *****/ if (!Gbl.Hlds.LstIsRead)