From 7a08d9bff542fb5feb10ef0a72fdac948cf99b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Fri, 18 Mar 2016 14:07:21 +0100 Subject: [PATCH] Version 15.150 --- swad_ID.c | 2 +- swad_banner.c | 2 +- swad_centre.c | 2 +- swad_changelog.h | 3 +- swad_country.c | 2 +- swad_course.c | 2 +- swad_degree.c | 4 +- swad_department.c | 2 +- swad_file_browser.c | 2 +- swad_follow.c | 3 +- swad_global.h | 11 +++- swad_group.c | 2 +- swad_indicator.c | 18 ++--- swad_info.c | 4 +- swad_institution.c | 2 +- swad_place.c | 2 +- swad_record.c | 10 +-- swad_statistic.c | 3 +- swad_syllabus.c | 2 +- swad_timetable.c | 157 ++++++++++++++++++++++---------------------- swad_timetable.h | 2 +- 21 files changed, 119 insertions(+), 118 deletions(-) diff --git a/swad_ID.c b/swad_ID.c index 96f80915..99ee46c6 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -410,7 +410,7 @@ void ID_ShowFormOthIDs (void) Rec_ShowSharedUsrRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); /***** Form with the user's ID *****/ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,"
"); ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat, (Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me? fprintf (Gbl.F.Out,"
"); diff --git a/swad_banner.c b/swad_banner.c index a2a65edf..cd967a76 100644 --- a/swad_banner.c +++ b/swad_banner.c @@ -89,7 +89,7 @@ void Ban_SeeBanners (void) Lay_StartRoundFrame ("300px",Txt_Banners,Ban_PutFormToEditBanners); /***** Write all the banners *****/ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,"
"); for (NumBan = 0; NumBan < Gbl.Banners.Num; NumBan++) diff --git a/swad_centre.c b/swad_centre.c index 48971661..653a2b2a 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -624,7 +624,7 @@ static void Ctr_ListCentresForSeeing (bool ICanEdit) Lay_StartRoundFrame (NULL,Gbl.Title, ICanEdit ? Ctr_PutIconToEditFrames : NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Ctr_PutHeadCentresForSeeing (true); // Order selectable /***** Write all the centres and their nuber of teachers *****/ diff --git a/swad_changelog.h b/swad_changelog.h index ea068732..1b25254a 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -134,13 +134,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.149.1 (2016-03-18)" +#define Log_PLATFORM_VERSION "SWAD 15.150 (2016-03-18)" #define CSS_FILE "swad15.146.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.150: Mar 18, 2016 Icon to edit timetable integrated in frame. (195923 lines) Version 15.149.1: Mar 18, 2016 Button Done after internal editor of syllabus. Focus on new item in internal editor of syllabus. Removed links to view course info. (195920 lines) diff --git a/swad_country.c b/swad_country.c index 954c950d..594c8690 100644 --- a/swad_country.c +++ b/swad_country.c @@ -504,7 +504,7 @@ void Cty_ListCountries2 (void) Lay_StartRoundFrame (NULL,Txt_Countries, Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ? Cty_PutIconToEditCountries : NULL); - fprintf (Gbl.F.Out,"
" + fprintf (Gbl.F.Out,"
" ""); for (Order = Cty_ORDER_BY_COUNTRY; Order <= Cty_ORDER_BY_NUM_USRS; diff --git a/swad_course.c b/swad_course.c index 112cc526..79da1514 100644 --- a/swad_course.c +++ b/swad_course.c @@ -1153,7 +1153,7 @@ static void Crs_ListCoursesForSeeing (bool ICanEdit) Lay_StartRoundFrame (NULL,Gbl.Title, ICanEdit ? Crs_PutIconToEditCourses : NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Crs_PutHeadCoursesForSeeing (); /***** List the courses *****/ diff --git a/swad_degree.c b/swad_degree.c index 5ae40ffd..279d016f 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -1150,7 +1150,7 @@ static void Deg_ListDegreeTypesForSeeing (void) Lay_StartRoundFrame (NULL,Txt_Types_of_degree, Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ? Deg_PutIconToEditDegTypes : NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Deg_PutHeadDegreeTypesForSeeing (); /***** List degree types with forms for edition *****/ @@ -1276,7 +1276,7 @@ static void Deg_ListDegreesForSeeing (bool ICanEdit) Lay_StartRoundFrame (NULL,Gbl.Title, ICanEdit ? Deg_PutIconToEditDegrees : NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Deg_PutHeadDegreesForSeeing (); /***** List the degrees *****/ diff --git a/swad_department.c b/swad_department.c index b8a1be92..f27b1dbb 100644 --- a/swad_department.c +++ b/swad_department.c @@ -99,7 +99,7 @@ void Dpt_SeeDepts (void) Lay_StartRoundFrame (NULL,Txt_Departments, Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM ? Dpt_PutIconToEditDpts : NULL); - fprintf (Gbl.F.Out,"
" + fprintf (Gbl.F.Out,"
" ""); for (Order = Dpt_ORDER_BY_DEPARTMENT; Order <= Dpt_ORDER_BY_NUM_TCHS; diff --git a/swad_file_browser.c b/swad_file_browser.c index 91e8d477..aa85790f 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -3478,7 +3478,7 @@ static void Brw_ShowFileBrowser (void) FunctionToDrawContextualIcons); /***** Title *****/ - fprintf (Gbl.F.Out,"
" + fprintf (Gbl.F.Out,"
" "" "
", Brw_NumColumnsInExpTree[Gbl.FileBrowser.Type]); diff --git a/swad_follow.c b/swad_follow.c index 0495067d..e9c9b71c 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -223,8 +223,7 @@ void Fol_SuggestWhoToFollow (void) Usr_UsrDataConstructor (&UsrDat); /***** Start listing *****/ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,"
"); for (NumUsr = 0; NumUsr < NumUsrs; diff --git a/swad_global.h b/swad_global.h index 0d1033df..26a543e6 100644 --- a/swad_global.h +++ b/swad_global.h @@ -605,12 +605,21 @@ struct Globals } Pag; struct { - unsigned Day,Hour,Column; + TT_TimeTableType_t Type; + unsigned Day; + unsigned Hour; + unsigned Column; TT_ClassType_t ClassType; unsigned Duration; char Place[TT_MAX_BYTES_PLACE+1]; char Group[TT_MAX_BYTES_GROUP+1]; long GrpCod; // Group code (-1 if no group selected) + struct + { + bool PutIconPrint; + bool PutIconEditCrsTT; + bool PutIconEditOfficeHours; + } ContextualIcons; } TimeTable; struct { diff --git a/swad_group.c b/swad_group.c index 5ed53f3a..737969f7 100644 --- a/swad_group.c +++ b/swad_group.c @@ -1577,7 +1577,7 @@ void Grp_ShowLstGrpsToChgMyGrps (bool ShowWarningsToStudents) Act_FormStart (ActChgGrp); /***** List the groups the user belongs to for change *****/ - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); for (NumGrpTyp = 0; NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num; NumGrpTyp++) diff --git a/swad_indicator.c b/swad_indicator.c index 7692b270..83d54954 100644 --- a/swad_indicator.c +++ b/swad_indicator.c @@ -90,16 +90,13 @@ void Ind_ReqIndicatorsCourses (void) unsigned NumCrss; /***** Start frame *****/ - Lay_StartRoundFrameTable (NULL,2,Txt_Indicators_of_courses); - - fprintf (Gbl.F.Out,"" - "
"); + Lay_StartRoundFrame (NULL,Txt_Indicators_of_courses,NULL); /***** Form to update indicators *****/ /* Start form */ Act_FormStart (ActReqStaCrs); - fprintf (Gbl.F.Out,"" + fprintf (Gbl.F.Out,"
" "" "" ""); - /* Show only courses with a numer of indicators */ + /* Show only courses with a number of indicators */ Gbl.Stat.NumIndicators = Ind_GetParamNumIndicators (); fprintf (Gbl.F.Out,"" "" - "" - "" - "" - ""); - Lay_EndRoundFrameTable (); + Lay_EndRoundFrame (); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); diff --git a/swad_info.c b/swad_info.c index 9329920c..f8e3b3d3 100644 --- a/swad_info.c +++ b/swad_info.c @@ -1590,7 +1590,7 @@ static void Inf_ShowPlainTxtInfo (void) Lay_StartRoundFrame (NULL,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type], ICanEdit ? Inf_PutIconToEditInfo : NULL); - fprintf (Gbl.F.Out,"
" "%s:" @@ -143,7 +140,7 @@ void Ind_ReqIndicatorsCourses (void) fprintf (Gbl.F.Out,"
" @@ -181,11 +178,6 @@ void Ind_ReqIndicatorsCourses (void) /* End form */ Act_FormEnd (); - fprintf (Gbl.F.Out,"
"); - /***** Get courses from database *****/ NumCrss = Ind_GetTableOfCourses (&mysql_res); if (Ind_GetIfShowBigList (NumCrss)) @@ -205,9 +197,7 @@ void Ind_ReqIndicatorsCourses (void) } /***** End frame *****/ - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); if (Gbl.CurrentCrs.Info.Type == Inf_INTRODUCTION || Gbl.CurrentCrs.Info.Type == Inf_TEACHING_GUIDE) @@ -1646,7 +1646,7 @@ static void Inf_ShowRichTxtInfo (void) Lay_StartRoundFrame (NULL,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type], ICanEdit ? Inf_PutIconToEditInfo : NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); if (Gbl.CurrentCrs.Info.Type == Inf_INTRODUCTION || Gbl.CurrentCrs.Info.Type == Inf_TEACHING_GUIDE) diff --git a/swad_institution.c b/swad_institution.c index 897a72eb..6b334d10 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -558,7 +558,7 @@ static void Ins_ListInstitutionsForSeeing (bool ICanEdit) Lay_StartRoundFrame (NULL,Gbl.Title, ICanEdit ? Ins_PutIconToEditInstitutions : NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); Ins_PutHeadInstitutionsForSeeing (true); // Order selectable /***** Write all the institutions and their nuber of users *****/ diff --git a/swad_place.c b/swad_place.c index 9e50781b..890ddb5c 100644 --- a/swad_place.c +++ b/swad_place.c @@ -96,7 +96,7 @@ void Plc_SeePlaces (void) Lay_StartRoundFrame (NULL,Txt_Places, Gbl.Usrs.Me.LoggedRole >= Rol_INS_ADM ? Plc_PutIconToEditPlaces : NULL); - fprintf (Gbl.F.Out,"
" + fprintf (Gbl.F.Out,"
" ""); for (Order = Plc_ORDER_BY_PLACE; Order <= Plc_ORDER_BY_NUM_CTRS; diff --git a/swad_record.c b/swad_record.c index f67b14d4..e3b2f935 100644 --- a/swad_record.c +++ b/swad_record.c @@ -1193,8 +1193,9 @@ static void Rec_ShowRecordOneTchCrs (void) Rec_ShowSharedUsrRecord (Rec_RECORD_LIST,&Gbl.Usrs.Other.UsrDat); /* Office hours */ - Lay_StartRoundFrame (Width,Txt_TIMETABLE_TYPES[TT_TUTOR_TIMETABLE],NULL); - TT_ShowTimeTable (TT_TUTOR_TIMETABLE,Gbl.Usrs.Other.UsrDat.UsrCod); + Gbl.TimeTable.Type = TT_TUTOR_TIMETABLE; + Lay_StartRoundFrame (Width,Txt_TIMETABLE_TYPES[Gbl.TimeTable.Type],NULL); + TT_ShowTimeTable (Gbl.Usrs.Other.UsrDat.UsrCod); Lay_EndRoundFrame (); fprintf (Gbl.F.Out,""); @@ -1293,8 +1294,9 @@ void Rec_ListRecordsTchs (void) /* Office hours */ if (ShowOfficeHours) { - Lay_StartRoundFrame (Width,Txt_TIMETABLE_TYPES[TT_TUTOR_TIMETABLE],NULL); - TT_ShowTimeTable (TT_TUTOR_TIMETABLE,UsrDat.UsrCod); + Gbl.TimeTable.Type = TT_TUTOR_TIMETABLE; + Lay_StartRoundFrame (Width,Txt_TIMETABLE_TYPES[Gbl.TimeTable.Type],NULL); + TT_ShowTimeTable (UsrDat.UsrCod); Lay_EndRoundFrame (); } diff --git a/swad_statistic.c b/swad_statistic.c index 5cd897c2..00d4f2dc 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -604,8 +604,7 @@ void Sta_AskShowGblHits (void) /***** Start frame *****/ fprintf (Gbl.F.Out,"
"); Lay_StartRoundFrame (NULL,Txt_Statistics_of_all_visits,NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); /***** Start and end dates for the search *****/ Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (); diff --git a/swad_syllabus.c b/swad_syllabus.c index 9ab228ac..cbe01ba4 100644 --- a/swad_syllabus.c +++ b/swad_syllabus.c @@ -203,7 +203,7 @@ void Syl_EditSyllabus (void) Lay_StartRoundFrame (NULL,Txt_INFO_TITLE[Gbl.CurrentCrs.Info.Type], PutIconToEdit ? Inf_PutIconToEditInfo : NULL); - fprintf (Gbl.F.Out,"
"); + fprintf (Gbl.F.Out,"
"); /***** Write the current syllabus *****/ Syl_ShowSyllabus (); diff --git a/swad_timetable.c b/swad_timetable.c index 98fae3bc..9f4f5638 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -115,19 +115,19 @@ bool TimeTableHoursChecked[TT_HOURS_PER_DAY*2]; static void TT_ShowTimeTableGrpsSelected (void); static void TT_GetParamsTimeTable (void); +static void TT_PutContextualIcons (void); static void TT_ShowSelectorWhichGrps (Act_Action_t Action); static void TT_WriteCrsTimeTableIntoDB (long CrsCod); static void TT_WriteTutTimeTableIntoDB (long UsrCod); -static void TT_CreatTimeTableFromDB (TT_TimeTableType_t TimeTableType,long UsrCod); +static void TT_CreatTimeTableFromDB (long UsrCod); static void TT_ModifTimeTable (void); -static void TT_DrawTimeTable (TT_TimeTableType_t TimeTableType); +static void TT_DrawTimeTable (void); static void TT_TimeTableDrawAdjustRow (void); static void TT_TimeTableDrawDaysCells (void); static unsigned TT_TimeTableCalculateColsToDraw (unsigned Day,unsigned Hour); static void TT_DrawCellAlignTimeTable (void); -static void TT_TimeTableDrawCell (TT_TimeTableType_t TimeTableType, - unsigned Day,unsigned Hour,unsigned Column,unsigned ColSpan, +static void TT_TimeTableDrawCell (unsigned Day,unsigned Hour,unsigned Column,unsigned ColSpan, long CrsCod,TT_HourType_t HourType,TT_ClassType_t ClassType,unsigned Duration,char *Group,long GrpCod,char *Place); /*****************************************************************************/ @@ -221,14 +221,9 @@ static void TT_GetParamsTimeTable (void) void TT_ShowClassTimeTable (void) { - extern const char *Txt_Edit; - extern const char *Txt_Edit_office_hours; - extern const char *Txt_Print; extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES]; - TT_TimeTableType_t TimeTableType = TT_COURSE_TIMETABLE; // Initialized to avoid warning - bool PrintView; - bool PutEditCrsTT; - bool PutEditOfficeHours; + bool PrintView = (Gbl.Action.Act == ActPrnCrsTT || + Gbl.Action.Act == ActPrnMyTT);; /***** Initializations *****/ switch (Gbl.Action.Act) @@ -236,56 +231,37 @@ void TT_ShowClassTimeTable (void) case ActSeeCrsTT: case ActPrnCrsTT: case ActChgCrsTT1stDay: - TimeTableType = TT_COURSE_TIMETABLE; + Gbl.TimeTable.Type = TT_COURSE_TIMETABLE; break; case ActSeeMyTT: case ActPrnMyTT: case ActChgMyTT1stDay: - TimeTableType = TT_MY_TIMETABLE; + Gbl.TimeTable.Type = TT_MY_TIMETABLE; break; default: Lay_ShowErrorAndExit ("Wrong action."); } - PrintView = (Gbl.Action.Act == ActPrnCrsTT || - Gbl.Action.Act == ActPrnMyTT); - PutEditCrsTT = (TimeTableType == TT_COURSE_TIMETABLE && - !PrintView && - Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER); - PutEditOfficeHours = (TimeTableType == TT_MY_TIMETABLE && - !PrintView && - (Gbl.Usrs.Me.AvailableRoles & (1 << Rol_TEACHER))); + Gbl.TimeTable.ContextualIcons.PutIconPrint = !PrintView; + Gbl.TimeTable.ContextualIcons.PutIconEditCrsTT = (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE && + !PrintView && + Gbl.Usrs.Me.LoggedRole >= Rol_TEACHER); + Gbl.TimeTable.ContextualIcons.PutIconEditOfficeHours = (Gbl.TimeTable.Type == TT_MY_TIMETABLE && + !PrintView && + (Gbl.Usrs.Me.AvailableRoles & (1 << Rol_TEACHER))); /***** Get whether to show only my groups or all groups *****/ Grp_GetParamWhichGrps (); - /***** Put buttons *****/ - if (PutEditCrsTT || PutEditOfficeHours || !PrintView) - { - fprintf (Gbl.F.Out,"
"); - - if (PutEditCrsTT) - Lay_PutContextualLink (ActEdiCrsTT,Grp_PutParamWhichGrps, - "edit64x64.png", - Txt_Edit,Txt_Edit); - - if (PutEditOfficeHours) - Lay_PutContextualLink (ActEdiTut,NULL,"edit64x64.png", - Txt_Edit_office_hours,Txt_Edit_office_hours); - - if (!PrintView) - Lay_PutContextualLink (TimeTableType == TT_COURSE_TIMETABLE ? ActPrnCrsTT : - ActPrnMyTT, - Grp_PutParamWhichGrps,"print64x64.png", - Txt_Print,Txt_Print); - - fprintf (Gbl.F.Out,"
"); - } - /***** Start frame *****/ - Lay_StartRoundFrameTable ("100%",0,Txt_TIMETABLE_TYPES[TimeTableType]); + Lay_StartRoundFrame ("100%",Txt_TIMETABLE_TYPES[Gbl.TimeTable.Type], + (Gbl.TimeTable.ContextualIcons.PutIconEditCrsTT || + Gbl.TimeTable.ContextualIcons.PutIconEditOfficeHours || + Gbl.TimeTable.ContextualIcons.PutIconPrint) ? TT_PutContextualIcons : + NULL); + fprintf (Gbl.F.Out,"
"); /***** Start time table drawing *****/ - if (TimeTableType == TT_COURSE_TIMETABLE) + if (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE) Lay_WriteHeaderClassPhoto (1,PrintView,false, Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentCrs.Crs.CrsCod); @@ -298,11 +274,11 @@ void TT_ShowClassTimeTable (void) "" @@ -312,12 +288,39 @@ void TT_ShowClassTimeTable (void) /***** Show the time table *****/ fprintf (Gbl.F.Out,"" "" - ""); + "" + "
"); /***** Select whether show only my groups or all groups *****/ - TT_ShowSelectorWhichGrps (TimeTableType == TT_COURSE_TIMETABLE ? ActSeeCrsTT : + TT_ShowSelectorWhichGrps (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE ? ActSeeCrsTT : ActSeeMyTT); /***** Show form to change first day of week *****/ - Cal_ShowIntegratedFormToSelFirstDayOfWeek (TimeTableType == TT_COURSE_TIMETABLE ? ActChgCrsTT1stDay : + Cal_ShowIntegratedFormToSelFirstDayOfWeek (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE ? ActChgCrsTT1stDay : ActChgMyTT1stDay); fprintf (Gbl.F.Out,"
"); - TT_ShowTimeTable (TimeTableType,Gbl.Usrs.Me.UsrDat.UsrCod); + TT_ShowTimeTable (Gbl.Usrs.Me.UsrDat.UsrCod); fprintf (Gbl.F.Out,"
"); /***** End frame *****/ - Lay_EndRoundFrameTable (); + Lay_EndRoundFrame (); + } + +/*****************************************************************************/ +/***************** Put contextual icons above the time table *****************/ +/*****************************************************************************/ + +static void TT_PutContextualIcons (void) + { + extern const char *Txt_Edit; + extern const char *Txt_Edit_office_hours; + extern const char *Txt_Print; + + if (Gbl.TimeTable.ContextualIcons.PutIconEditCrsTT) + Lay_PutContextualLink (ActEdiCrsTT,Grp_PutParamWhichGrps, + "edit64x64.png", + Txt_Edit,NULL); + + if (Gbl.TimeTable.ContextualIcons.PutIconEditOfficeHours) + Lay_PutContextualLink (ActEdiTut,NULL,"edit64x64.png", + Txt_Edit_office_hours,NULL); + + if (Gbl.TimeTable.ContextualIcons.PutIconPrint) + Lay_PutContextualLink (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE ? ActPrnCrsTT : + ActPrnMyTT, + Grp_PutParamWhichGrps,"print64x64.png", + Txt_Print,NULL); } /*****************************************************************************/ @@ -347,8 +350,9 @@ void TT_EditCrsTimeTable (void) fprintf (Gbl.F.Out,""); /***** Editable time table *****/ - Lay_StartRoundFrame ("100%",Txt_TIMETABLE_TYPES[TT_COURSE_TIMETABLE],NULL); - TT_ShowTimeTable (TT_COURSE_TIMETABLE,Gbl.Usrs.Me.UsrDat.UsrCod); + Gbl.TimeTable.Type = TT_COURSE_TIMETABLE; + Lay_StartRoundFrame ("100%",Txt_TIMETABLE_TYPES[Gbl.TimeTable.Type],NULL); + TT_ShowTimeTable (Gbl.Usrs.Me.UsrDat.UsrCod); Lay_EndRoundFrame (); } @@ -368,8 +372,9 @@ void TT_ShowMyTutTimeTable (void) fprintf (Gbl.F.Out,""); /***** Time table *****/ - Lay_StartRoundFrame ("100%",Txt_TIMETABLE_TYPES[TT_TUTOR_TIMETABLE],NULL); - TT_ShowTimeTable (TT_TUTOR_TIMETABLE,Gbl.Usrs.Me.UsrDat.UsrCod); + Gbl.TimeTable.Type = TT_TUTOR_TIMETABLE; + Lay_StartRoundFrame ("100%",Txt_TIMETABLE_TYPES[Gbl.TimeTable.Type],NULL); + TT_ShowTimeTable (Gbl.Usrs.Me.UsrDat.UsrCod); Lay_EndRoundFrame (); } @@ -377,10 +382,10 @@ void TT_ShowMyTutTimeTable (void) /*********** Show course timetable or tutor timetable of a teacher ***********/ /*****************************************************************************/ -void TT_ShowTimeTable (TT_TimeTableType_t TimeTableType,long UsrCod) +void TT_ShowTimeTable (long UsrCod) { /***** Create an internal table with the timetable from database *****/ - TT_CreatTimeTableFromDB (TimeTableType,UsrCod); + TT_CreatTimeTableFromDB (UsrCod); /***** If timetable must be modified... *****/ if (Gbl.Action.Act == ActChgCrsTT || @@ -393,7 +398,7 @@ void TT_ShowTimeTable (TT_TimeTableType_t TimeTableType,long UsrCod) TT_ModifTimeTable (); /* Write a new timetable in database */ - switch (TimeTableType) + switch (Gbl.TimeTable.Type) { case TT_COURSE_TIMETABLE: TT_WriteCrsTimeTableIntoDB (Gbl.CurrentCrs.Crs.CrsCod); @@ -406,11 +411,11 @@ void TT_ShowTimeTable (TT_TimeTableType_t TimeTableType,long UsrCod) } /* Get a new table from database */ - TT_CreatTimeTableFromDB (TimeTableType,UsrCod); + TT_CreatTimeTableFromDB (UsrCod); } /***** Draw timetable *****/ - TT_DrawTimeTable (TimeTableType); + TT_DrawTimeTable (); } /*****************************************************************************/ @@ -492,7 +497,7 @@ static void TT_WriteTutTimeTableIntoDB (long UsrCod) /********** Create an internal table with timetable from database ************/ /*****************************************************************************/ -static void TT_CreatTimeTableFromDB (TT_TimeTableType_t TimeTableType,long UsrCod) +static void TT_CreatTimeTableFromDB (long UsrCod) { extern const char *Txt_Incomplete_timetable_for_lack_of_space; char Query[4096]; @@ -530,7 +535,7 @@ static void TT_CreatTimeTableFromDB (TT_TimeTableType_t TimeTableType,long UsrCo } /***** Get timetable from database *****/ - switch (TimeTableType) + switch (Gbl.TimeTable.Type) { case TT_MY_TIMETABLE: switch (Gbl.CurrentCrs.Grps.WhichGrps) @@ -608,8 +613,8 @@ static void TT_CreatTimeTableFromDB (TT_TimeTableType_t TimeTableType,long UsrCo { row = mysql_fetch_row (mysql_res); - if (TimeTableType == TT_MY_TIMETABLE || - TimeTableType == TT_COURSE_TIMETABLE) + if (Gbl.TimeTable.Type == TT_MY_TIMETABLE || + Gbl.TimeTable.Type == TT_COURSE_TIMETABLE) /* Group code */ if (sscanf (row[6],"%ld",&GrpCod) != 1) GrpCod = -1; @@ -632,7 +637,7 @@ static void TT_CreatTimeTableFromDB (TT_TimeTableType_t TimeTableType,long UsrCo Lay_ShowErrorAndExit ("Wrong duration in timetable."); /* Type of class */ - switch (TimeTableType) + switch (Gbl.TimeTable.Type) { case TT_COURSE_TIMETABLE: case TT_MY_TIMETABLE: @@ -692,13 +697,13 @@ static void TT_CreatTimeTableFromDB (TT_TimeTableType_t TimeTableType,long UsrCo } /* Group and place */ - switch (TimeTableType) + switch (Gbl.TimeTable.Type) { case TT_MY_TIMETABLE: case TT_COURSE_TIMETABLE: TimeTable[Day][Hour].Columns[FirstFreeColumn].CrsCod = - (TimeTableType == TT_MY_TIMETABLE ? Str_ConvertStrCodToLongCod (row[7]) : - Gbl.CurrentCrs.Crs.CrsCod); + (Gbl.TimeTable.Type == TT_MY_TIMETABLE ? Str_ConvertStrCodToLongCod (row[7]) : + Gbl.CurrentCrs.Crs.CrsCod); strcpy (TimeTable[Day][Hour].Columns[FirstFreeColumn].Group,row[5]); TimeTable[Day][Hour].Columns[FirstFreeColumn].GrpCod = GrpCod; // no break; @@ -761,7 +766,7 @@ static void TT_ModifTimeTable (void) /********************* Draw timetable using internal table *******************/ /*****************************************************************************/ -static void TT_DrawTimeTable (TT_TimeTableType_t TimeTableType) +static void TT_DrawTimeTable (void) { bool Editing = false; unsigned DayColumn; // Column from left (0) to right (6) @@ -866,13 +871,11 @@ static void TT_DrawTimeTable (TT_TimeTableType_t TimeTableType) { if (ContinuousFreeMinicolumns) { - TT_TimeTableDrawCell (TimeTableType, - Day,Hour,Column-1,ContinuousFreeMinicolumns, + TT_TimeTableDrawCell (Day,Hour,Column-1,ContinuousFreeMinicolumns, -1L,TT_FREE_HOUR,TT_NO_CLASS,0,NULL,-1,NULL); ContinuousFreeMinicolumns = 0; } - TT_TimeTableDrawCell (TimeTableType, - Day,Hour,Column,TT_NUM_MINICOLUMNS_PER_DAY/ColumnsToDrawIncludingExtraColumn, + TT_TimeTableDrawCell (Day,Hour,Column,TT_NUM_MINICOLUMNS_PER_DAY/ColumnsToDrawIncludingExtraColumn, TimeTable[Day][Hour].Columns[Column].CrsCod, TimeTable[Day][Hour].Columns[Column].HourType, TimeTable[Day][Hour].Columns[Column].ClassType, @@ -882,8 +885,7 @@ static void TT_DrawTimeTable (TT_TimeTableType_t TimeTableType) TimeTable[Day][Hour].Columns[Column].Place); } if (ContinuousFreeMinicolumns) - TT_TimeTableDrawCell (TimeTableType, - Day,Hour,Column-1,ContinuousFreeMinicolumns, + TT_TimeTableDrawCell (Day,Hour,Column-1,ContinuousFreeMinicolumns, -1L,TT_FREE_HOUR,TT_NO_CLASS,0,NULL,-1L,NULL); } @@ -1057,8 +1059,7 @@ static void TT_DrawCellAlignTimeTable (void) /*************************** Write a timetable cell **************************/ /*****************************************************************************/ -static void TT_TimeTableDrawCell (TT_TimeTableType_t TimeTableType, - unsigned Day,unsigned Hour,unsigned Column,unsigned ColSpan, +static void TT_TimeTableDrawCell (unsigned Day,unsigned Hour,unsigned Column,unsigned ColSpan, long CrsCod,TT_HourType_t HourType,TT_ClassType_t ClassType,unsigned Duration,char *Group,long GrpCod,char *Place) { extern const char *Txt_unknown_course; @@ -1158,7 +1159,7 @@ static void TT_TimeTableDrawCell (TT_TimeTableType_t TimeTableType, if (HourType != TT_FREE_HOUR) // If cell is not empty... { fprintf (Gbl.F.Out,""); - if (TimeTableType == TT_MY_TIMETABLE) + if (Gbl.TimeTable.Type == TT_MY_TIMETABLE) { Crs.CrsCod = CrsCod; Crs_GetDataOfCourseByCod (&Crs); diff --git a/swad_timetable.h b/swad_timetable.h index 2a2c6f51..44673aef 100644 --- a/swad_timetable.h +++ b/swad_timetable.h @@ -67,6 +67,6 @@ typedef enum void TT_ShowClassTimeTable (void); void TT_EditCrsTimeTable (void); void TT_ShowMyTutTimeTable (void); -void TT_ShowTimeTable (TT_TimeTableType_t TimeTableType,long UsrCod); +void TT_ShowTimeTable (long UsrCod); #endif