Version 15.150

This commit is contained in:
Antonio Cañas Vargas 2016-03-18 14:07:21 +01:00
parent c118fb8dcc
commit 7a08d9bff5
21 changed files with 119 additions and 118 deletions

View File

@ -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,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat,
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me?
fprintf (Gbl.F.Out,"</table>");

View File

@ -89,7 +89,7 @@ void Ban_SeeBanners (void)
Lay_StartRoundFrame ("300px",Txt_Banners,Ban_PutFormToEditBanners);
/***** Write all the banners *****/
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
for (NumBan = 0;
NumBan < Gbl.Banners.Num;
NumBan++)

View File

@ -624,7 +624,7 @@ static void Ctr_ListCentresForSeeing (bool ICanEdit)
Lay_StartRoundFrame (NULL,Gbl.Title,
ICanEdit ? Ctr_PutIconToEditFrames :
NULL);
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
Ctr_PutHeadCentresForSeeing (true); // Order selectable
/***** Write all the centres and their nuber of teachers *****/

View File

@ -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)

View File

@ -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,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">"
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">"
"<tr>");
for (Order = Cty_ORDER_BY_COUNTRY;
Order <= Cty_ORDER_BY_NUM_USRS;

View File

@ -1153,7 +1153,7 @@ static void Crs_ListCoursesForSeeing (bool ICanEdit)
Lay_StartRoundFrame (NULL,Gbl.Title,
ICanEdit ? Crs_PutIconToEditCourses :
NULL);
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
Crs_PutHeadCoursesForSeeing ();
/***** List the courses *****/

View File

@ -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,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
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,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
Deg_PutHeadDegreesForSeeing ();
/***** List the degrees *****/

View File

@ -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,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">"
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">"
"<tr>");
for (Order = Dpt_ORDER_BY_DEPARTMENT;
Order <= Dpt_ORDER_BY_NUM_TCHS;

View File

@ -3478,7 +3478,7 @@ static void Brw_ShowFileBrowser (void)
FunctionToDrawContextualIcons);
/***** Title *****/
fprintf (Gbl.F.Out,"<table>"
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE\">"
"<tr>"
"<td class=\"CENTER_MIDDLE\" colspan=\"%u\">",
Brw_NumColumnsInExpTree[Gbl.FileBrowser.Type]);

View File

@ -223,8 +223,7 @@ void Fol_SuggestWhoToFollow (void)
Usr_UsrDataConstructor (&UsrDat);
/***** Start listing *****/
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\""
" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
for (NumUsr = 0;
NumUsr < NumUsrs;

View File

@ -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
{

View File

@ -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,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
for (NumGrpTyp = 0;
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
NumGrpTyp++)

View File

@ -90,16 +90,13 @@ void Ind_ReqIndicatorsCourses (void)
unsigned NumCrss;
/***** Start frame *****/
Lay_StartRoundFrameTable (NULL,2,Txt_Indicators_of_courses);
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"CENTER_MIDDLE\">");
Lay_StartRoundFrame (NULL,Txt_Indicators_of_courses,NULL);
/***** Form to update indicators *****/
/* Start form */
Act_FormStart (ActReqStaCrs);
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">"
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">"
"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
@ -143,7 +140,7 @@ void Ind_ReqIndicatorsCourses (void)
fprintf (Gbl.F.Out,"</td>"
"</tr>");
/* 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,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
@ -181,11 +178,6 @@ void Ind_ReqIndicatorsCourses (void)
/* End form */
Act_FormEnd ();
fprintf (Gbl.F.Out,"</td>"
"</tr>"
"<tr>"
"<td class=\"CENTER_MIDDLE\">");
/***** 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,"</td>"
"</tr>");
Lay_EndRoundFrameTable ();
Lay_EndRoundFrame ();
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);

View File

@ -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,"<table>");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE\">");
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,"<table>");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE\">");
if (Gbl.CurrentCrs.Info.Type == Inf_INTRODUCTION ||
Gbl.CurrentCrs.Info.Type == Inf_TEACHING_GUIDE)

View File

@ -558,7 +558,7 @@ static void Ins_ListInstitutionsForSeeing (bool ICanEdit)
Lay_StartRoundFrame (NULL,Gbl.Title,
ICanEdit ? Ins_PutIconToEditInstitutions :
NULL);
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
Ins_PutHeadInstitutionsForSeeing (true); // Order selectable
/***** Write all the institutions and their nuber of users *****/

View File

@ -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,"<table class=\"CELLS_PAD_2\" style=\"margin:0 auto;\">"
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">"
"<tr>");
for (Order = Plc_ORDER_BY_PLACE;
Order <= Plc_ORDER_BY_NUM_CTRS;

View File

@ -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,"</div>");
@ -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 ();
}

View File

@ -604,8 +604,7 @@ void Sta_AskShowGblHits (void)
/***** Start frame *****/
fprintf (Gbl.F.Out,"<section id=\"stat_form\">");
Lay_StartRoundFrame (NULL,Txt_Statistics_of_all_visits,NULL);
fprintf (Gbl.F.Out,"<table class=\"CELLS_PAD_2\""
" style=\"margin:0 auto;\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_2\">");
/***** Start and end dates for the search *****/
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();

View File

@ -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,"<table class=\"CELLS_PAD_1\" style=\"width:100%%\">");
fprintf (Gbl.F.Out,"<table class=\"FRAME_TABLE CELLS_PAD_1\">");
/***** Write the current syllabus *****/
Syl_ShowSyllabus ();

View File

@ -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,"<div class=\"CONTEXT_MENU\">");
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,"</div>");
}
/***** 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,"<table class=\"FRAME_TABLE\">");
/***** 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)
"<td>");
/***** 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,"</td>"
@ -312,12 +288,39 @@ void TT_ShowClassTimeTable (void)
/***** Show the time table *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"CENTER_MIDDLE\">");
TT_ShowTimeTable (TimeTableType,Gbl.Usrs.Me.UsrDat.UsrCod);
TT_ShowTimeTable (Gbl.Usrs.Me.UsrDat.UsrCod);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
"</tr>"
"</table>");
/***** 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,"</div>");
/***** 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,"</div>");
/***** 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,"<span class=\"TT_TXT\">");
if (TimeTableType == TT_MY_TIMETABLE)
if (Gbl.TimeTable.Type == TT_MY_TIMETABLE)
{
Crs.CrsCod = CrsCod;
Crs_GetDataOfCourseByCod (&Crs);

View File

@ -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