Version 23.53: Dec 15, 2023 Code refactoring and responsive design in timetable.

This commit is contained in:
acanas 2023-12-15 10:18:24 +01:00
parent 29ab5cb9fa
commit a8d8041f7a
14 changed files with 144 additions and 101 deletions

View File

@ -4168,9 +4168,9 @@ legend {font-size:12pt;}
.Tmt_HOURCOL {box-sizing:border-box; height:16px; width:7%;} .Tmt_HOURCOL {box-sizing:border-box; height:16px; width:7%;}
.Tmt_MINICOL {box-sizing:border-box; height:16px; width:2%;} .Tmt_MINICOL {box-sizing:border-box; height:16px; width:2%;}
.Tmt_ALIGN {box-sizing:border-box; height:16px; width:1%;} .Tmt_ALIGN {box-sizing:border-box; height:16px; width:1%;}
.Tmt_CELL {box-sizing:border-box; height:16px; border:solid 1px;} .Tmt_CELL {box-sizing:border-box; height:16px; border:solid 1px;}
.Tmt_FREE0_WHITE, .Tmt_FREE0_WHITE,
.Tmt_FREE0_GREY, .Tmt_FREE0_GREY,
@ -5200,17 +5200,59 @@ button.PAG_DARK:hover, .PAG_CUR_DARK {background-color:#707070;}
height:48px; height:48px;
} }
/************************* Indicators about courses **************************/ /************************* Table with horizontal scroll **********************/
.INDICATORS td,.INDICATORS th @media only screen and (max-width: 480px)
{ /* For mobile-phones */
.TBL_SCROLL
{
display: block;
overflow-x: auto;
width: 280px;
margin: 0 auto;
}
}
@media only screen and (min-width: 480px) and (max-width: 800px)
{ /* For mobile-phones */
.TBL_SCROLL
{
display: block;
overflow-x: auto;
width: 400px;
margin: 0 auto;
}
}
@media only screen and (min-width: 800px) and (max-width: 1024px)
{ /* For tablets */
.TBL_SCROLL
{
display: block;
overflow-x: auto;
width: 640px;
margin: 0 auto;
}
}
@media only screen and (min-width: 1024px)
{ /* For desktop */
.TBL_SCROLL
{
display: block;
overflow-x: auto;
width: 900px;
margin: 0 auto;
}
}
.TBL_SCROLL tbody {
display: table;
width: 100%;
}
.Ind_TBL td,.Ind_TBL th
{ {
border:1px solid silver; border:1px solid silver;
border-collapse:collapse; border-collapse:collapse;
padding:1px; padding:1px;
} }
.INDICATORS_INPUT
{
max-width:500px;
}
/************* Forms to edit institution, center, degree, course *************/ /************* Forms to edit institution, center, degree, course *************/
.CODE .CODE

View File

@ -1987,6 +1987,11 @@ void HTM_Unsigned (unsigned Num)
HTM_TxtF ("%u",Num); HTM_TxtF ("%u",Num);
} }
void HTM_UnsignedColon (unsigned Num)
{
HTM_TxtF ("%u:",Num);
}
void HTM_Light0 (void) void HTM_Light0 (void)
{ {
HTM_SPAN_Begin ("class=\"VERY_LIGHT\""); HTM_SPAN_Begin ("class=\"VERY_LIGHT\"");

View File

@ -234,6 +234,7 @@ void HTM_Comma (void);
void HTM_Hyphen (void); void HTM_Hyphen (void);
void HTM_Asterisk (void); void HTM_Asterisk (void);
void HTM_Unsigned (unsigned Num); void HTM_Unsigned (unsigned Num);
void HTM_UnsignedColon (unsigned Num);
void HTM_Light0 (void); void HTM_Light0 (void);
void HTM_Int (int Num); void HTM_Int (int Num);
void HTM_UnsignedLong (unsigned long Num); void HTM_UnsignedLong (unsigned long Num);

View File

@ -2678,7 +2678,7 @@ static void Att_ListEventsToSelect (struct Att_Events *Events,
The_GetSuffix (), The_GetSuffix (),
The_GetColorRows ()); The_GetColorRows ());
HTM_LABEL_Begin ("for=\"Event%u\"",NumAttEvent); HTM_LABEL_Begin ("for=\"Event%u\"",NumAttEvent);
HTM_TxtF ("%u:",NumAttEvent + 1); HTM_UnsignedColon (NumAttEvent + 1);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -3071,7 +3071,7 @@ static void Att_ListAttEventsForAStd (struct Att_Events *Events,
"DAT", "DAT",
The_GetSuffix (), The_GetSuffix (),
The_GetColorRows ()); The_GetColorRows ());
HTM_TxtF ("%u:",NumUsr); HTM_UnsignedColon (NumUsr);
HTM_TD_End (); HTM_TD_End ();
/***** Show student's photo *****/ /***** Show student's photo *****/
@ -3140,7 +3140,7 @@ static void Att_ListAttEventsForAStd (struct Att_Events *Events,
"DAT_RED", "DAT_RED",
The_GetSuffix (), The_GetSuffix (),
The_GetColorRows ()); The_GetColorRows ());
HTM_TxtF ("%u:",NumAttEvent + 1); HTM_UnsignedColon (NumAttEvent + 1);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"BT %s\"",The_GetColorRows ()); HTM_TD_Begin ("class=\"BT %s\"",The_GetColorRows ());

View File

@ -633,10 +633,12 @@ Me sale este error, no s
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/ */
#define Log_PLATFORM_VERSION "SWAD 23.52.56 (2023-12-14)" #define Log_PLATFORM_VERSION "SWAD 23.53 (2023-12-14)"
#define CSS_FILE "swad23.52.5.css" #define CSS_FILE "swad23.53.css"
#define JS_FILE "swad23.52.js" #define JS_FILE "swad23.52.js"
/* /*
Version 23.53: Dec 15, 2023 Code refactoring and responsive design in timetable. (335817 lines)
Version 23.52.7: Dec 14, 2023 Responsive design in indicators. (335817 lines)
Version 23.52.6: Dec 14, 2023 Responsive design in average photos of degrees. (335817 lines) Version 23.52.6: Dec 14, 2023 Responsive design in average photos of degrees. (335817 lines)
Version 23.52.5: Dec 13, 2023 Responsive design in follow. (335814 lines) Version 23.52.5: Dec 13, 2023 Responsive design in follow. (335814 lines)
Version 23.52.4: Dec 13, 2023 Responsive design in hierarchy configuration and connected users. (335821 lines) Version 23.52.4: Dec 13, 2023 Responsive design in hierarchy configuration and connected users. (335821 lines)

View File

@ -114,7 +114,7 @@ void DegTyp_WriteSelectorDegreeTypes (long SelectedDegTypCod)
/* List degree types */ /* List degree types */
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL, HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
"id=\"OthDegTypCod\" name=\"OthDegTypCod\"" "id=\"OthDegTypCod\" name=\"OthDegTypCod\""
" class=\"INPUT_%s\"", " class=\"REC_C2_BOT_INPUT INPUT_%s\"",
The_GetSuffix ()); The_GetSuffix ());
HTM_OPTION (HTM_Type_STRING,"-1", HTM_OPTION (HTM_Type_STRING,"-1",
SelectedDegTypCod <= 0 ? HTM_OPTION_SELECTED : SelectedDegTypCod <= 0 ? HTM_OPTION_SELECTED :

View File

@ -613,7 +613,7 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams)
The_GetSuffix (), The_GetSuffix (),
The_GetColorRows ()); The_GetColorRows ());
HTM_LABEL_Begin ("for=\"Gam%u\"",NumExam); HTM_LABEL_Begin ("for=\"Gam%u\"",NumExam);
HTM_TxtF ("%u:",NumExam + 1); HTM_UnsignedColon (NumExam + 1);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();

View File

@ -63,6 +63,7 @@ extern struct Globals Gbl;
/******************************* Private types *******************************/ /******************************* Private types *******************************/
/*****************************************************************************/ /*****************************************************************************/
#define Ind_NUM_LAYOUTS 2
typedef enum typedef enum
{ {
Ind_INDICATORS_BRIEF, Ind_INDICATORS_BRIEF,
@ -133,10 +134,10 @@ void Ind_ReqIndicatorsCourses (void)
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT","ScopeInd",Txt_Scope); Frm_LabelColumn ("REC_C1_BOT RT","ScopeInd",Txt_Scope);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"REC_C2_BOT LT\"");
Sco_PutSelectorScope ("ScopeInd",HTM_SUBMIT_ON_CHANGE); Sco_PutSelectorScope ("ScopeInd",HTM_SUBMIT_ON_CHANGE);
HTM_TD_End (); HTM_TD_End ();
@ -146,10 +147,10 @@ void Ind_ReqIndicatorsCourses (void)
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",Par_CodeStr[ParCod_OthDegTyp],Txt_Types_of_degree); Frm_LabelColumn ("REC_C1_BOT RT",Par_CodeStr[ParCod_OthDegTyp],Txt_Types_of_degree);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"REC_C2_BOT LT DAT_%s\"",The_GetSuffix ());
DegTyp_WriteSelectorDegreeTypes (Indicators.DegTypCod); DegTyp_WriteSelectorDegreeTypes (Indicators.DegTypCod);
HTM_Txt (" ("); HTM_Txt (" (");
HTM_TxtF (Txt_only_if_the_scope_is_X,Cfg_PLATFORM_SHORT_NAME); HTM_TxtF (Txt_only_if_the_scope_is_X,Cfg_PLATFORM_SHORT_NAME);
@ -162,11 +163,11 @@ void Ind_ReqIndicatorsCourses (void)
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
/* Label */ /* Label */
Frm_LabelColumn ("RT",Par_CodeStr[ParCod_Dpt],Txt_Department); Frm_LabelColumn ("REC_C1_BOT RT",Par_CodeStr[ParCod_Dpt],Txt_Department);
/* Data */ /* Data */
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"REC_C2_BOT LT\"");
if (asprintf (&SelectClass,"INDICATORS_INPUT INPUT_%s", if (asprintf (&SelectClass,"REC_C2_BOT_INPUT INPUT_%s",
The_GetSuffix ()) < 0) The_GetSuffix ()) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
Dpt_WriteSelectorDepartment (Gbl.Hierarchy.Node[Hie_INS].HieCod, // Departments in current insitution Dpt_WriteSelectorDepartment (Gbl.Hierarchy.Node[Hie_INS].HieCod, // Departments in current insitution
@ -195,9 +196,9 @@ void Ind_ReqIndicatorsCourses (void)
/* Selection of the number of indicators */ /* Selection of the number of indicators */
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
Frm_LabelColumn ("RT","",Txt_Number_of_indicators); Frm_LabelColumn ("REC_C1_BOT RT","",Txt_Number_of_indicators);
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"REC_C2_BOT LT\"");
Ind_ShowNumCoursesWithIndicators (&Indicators,NumCrssWithIndicatorYes,NumCrss,true); Ind_ShowNumCoursesWithIndicators (&Indicators,NumCrssWithIndicatorYes,NumCrss,true);
HTM_TD_End (); HTM_TD_End ();
@ -438,7 +439,6 @@ static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indic
unsigned NumCrss, unsigned NumCrss,
Frm_PutForm_t PutForm) Frm_PutForm_t PutForm)
{ {
extern const char *Txt_Indicators;
extern const char *Txt_HIERARCHY_PLURAL_Abc[Hie_NUM_LEVELS]; extern const char *Txt_HIERARCHY_PLURAL_Abc[Hie_NUM_LEVELS];
extern const char *Txt_Total; extern const char *Txt_Total;
char *ClassNormal; char *ClassNormal;
@ -459,7 +459,7 @@ static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indic
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
if (PutForm == Frm_PUT_FORM) if (PutForm == Frm_PUT_FORM)
HTM_TH_Empty (1); HTM_TH_Empty (1);
HTM_TH (Txt_Indicators ,HTM_HEAD_RIGHT); HTM_TH_Empty (1);
HTM_TH_Span (Txt_HIERARCHY_PLURAL_Abc[Hie_CRS],HTM_HEAD_RIGHT,1,2,NULL); HTM_TH_Span (Txt_HIERARCHY_PLURAL_Abc[Hie_CRS],HTM_HEAD_RIGHT,1,2,NULL);
HTM_TR_End (); HTM_TR_End ();
@ -484,7 +484,7 @@ static void Ind_ShowNumCoursesWithIndicators (const struct Ind_Indicators *Indic
HTM_TD_Begin ("class=\"%s\"",Class); HTM_TD_Begin ("class=\"%s\"",Class);
HTM_LABEL_Begin ("for=\"Indicators%u\"",Ind); HTM_LABEL_Begin ("for=\"Indicators%u\"",Ind);
HTM_Unsigned (Ind); HTM_UnsignedColon (Ind);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -563,9 +563,14 @@ static void Ind_ShowTableOfCoursesWithIndicators (const struct Ind_Indicators *I
unsigned NumIndicators; unsigned NumIndicators;
struct Ind_IndicatorsCrs IndicatorsCrs; struct Ind_IndicatorsCrs IndicatorsCrs;
long ActCod; long ActCod;
static const char *TableClass[Ind_NUM_LAYOUTS] =
{
[Ind_INDICATORS_BRIEF] = "Ind_TBL TBL_SCROLL",
[Ind_INDICATORS_FULL ] = "Ind_TBL",
};
/***** Begin table *****/ /***** Begin table *****/
HTM_TABLE_Begin ("INDICATORS"); HTM_TABLE_Begin (TableClass[IndicatorsLayout]);
/***** Write table heading *****/ /***** Write table heading *****/
switch (IndicatorsLayout) switch (IndicatorsLayout)

View File

@ -575,7 +575,7 @@ static void MchRes_ListGamesToSelect (struct Gam_Games *Games)
The_GetSuffix (), The_GetSuffix (),
The_GetColorRows ()); The_GetColorRows ());
HTM_LABEL_Begin ("for=\"Gam%u\"",NumGame); HTM_LABEL_Begin ("for=\"Gam%u\"",NumGame);
HTM_TxtF ("%u:",NumGame + 1); HTM_UnsignedColon (NumGame + 1);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();

View File

@ -2033,7 +2033,8 @@ static void Pho_PutLinkToCalculateDegreeStats (const struct Pho_DegPhotos *DegPh
/* Selector with all degrees with students */ /* Selector with all degrees with students */
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL, HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,NULL,
"name=\"OthDegCod\" class=\"INPUT_%s\"", "name=\"OthDegCod\""
" class=\"REC_C2_BOT_INPUT INPUT_%s\"",
The_GetSuffix ()); The_GetSuffix ());
for (NumDeg = 0; for (NumDeg = 0;
NumDeg < Degs.Num; NumDeg < Degs.Num;

View File

@ -1310,9 +1310,8 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
Frm_BeginForm (ActPrnRecSevTch); Frm_BeginForm (ActPrnRecSevTch);
Usr_PutParSelectedUsrsCods (&Gbl.Usrs.Selected); Usr_PutParSelectedUsrsCods (&Gbl.Usrs.Selected);
Par_PutParChar ("ParamOfficeHours",'Y'); Par_PutParChar ("ParamOfficeHours",'Y');
Par_PutParChar ("ShowOfficeHours", Par_PutParChar ("ShowOfficeHours",ShowOfficeHours ? 'Y' :
ShowOfficeHours ? 'Y' : 'N');
'N');
Rec_ShowLinkToPrintPreviewOfRecords (); Rec_ShowLinkToPrintPreviewOfRecords ();
Frm_EndForm (); Frm_EndForm ();
@ -1365,7 +1364,9 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
Timetable.Type = Tmt_TUTORING_TIMETABLE; Timetable.Type = Tmt_TUTORING_TIMETABLE;
Box_BoxBegin ("100%",Txt_TIMETABLE_TYPES[Timetable.Type], Box_BoxBegin ("100%",Txt_TIMETABLE_TYPES[Timetable.Type],
NULL,NULL, NULL,NULL,
Hlp_USERS_Teachers_timetable,Box_NOT_CLOSABLE); Gbl.Action.Act == ActSeeRecSevTch ? Hlp_USERS_Teachers_timetable :
NULL,
Box_NOT_CLOSABLE);
Tmt_ShowTimeTable (&Timetable,UsrDat.UsrCod); Tmt_ShowTimeTable (&Timetable,UsrDat.UsrCod);
Box_BoxEnd (); Box_BoxEnd ();
HTM_DIV_End (); HTM_DIV_End ();

View File

@ -3902,7 +3902,7 @@ const char *Txt_Calculate_average_photo_of_THE_DEGREE_X = // Warning: should end
#elif L==5 // fr #elif L==5 // fr
"Calculer la photo moyenne de "; "Calculer la photo moyenne de ";
#elif L==6 // gn #elif L==6 // gn
"Calcular fotograf&iacute;a promedio de "; // Okoteve traducción "Okalkula ta'anga promedio ";
#elif L==7 // it #elif L==7 // it
"Calcolare la media della foto di "; "Calcolare la media della foto di ";
#elif L==8 // pl #elif L==8 // pl
@ -3910,7 +3910,7 @@ const char *Txt_Calculate_average_photo_of_THE_DEGREE_X = // Warning: should end
#elif L==9 // pt #elif L==9 // pt
"Calcular a foto m&eacute;dia de "; "Calcular a foto m&eacute;dia de ";
#elif L==10 // tr #elif L==10 // tr
"Calculate average photo of "; // Çeviri lazim! "Ortalama foto&gbreve;raf&inodot;n&inodot; hesaplay&inodot;n ";
#endif #endif
const char *Txt_Calendar = const char *Txt_Calendar =
@ -17232,7 +17232,7 @@ const char *Txt_Indicators_of_courses =
#elif L==5 // fr #elif L==5 // fr
"Indicateurs de mati&egrave;res"; "Indicateurs de mati&egrave;res";
#elif L==6 // gn #elif L==6 // gn
"Indicadores de asignaturas"; // Okoteve traducción "Umi mba'e ohechauk&aacute;va tema rehegua";
#elif L==7 // it #elif L==7 // it
"Indicatori di corsi"; "Indicatori di corsi";
#elif L==8 // pl #elif L==8 // pl
@ -17240,7 +17240,7 @@ const char *Txt_Indicators_of_courses =
#elif L==9 // pt #elif L==9 // pt
"Indicadores de disciplinas"; "Indicadores de disciplinas";
#elif L==10 // tr #elif L==10 // tr
"Indicators of courses"; // Çeviri lazim! "Kurs g&ouml;stergeleri";
#endif #endif
const char *Txt_Info = const char *Txt_Info =

View File

@ -367,7 +367,7 @@ void Tmt_ShowClassTimeTable (void)
else else
Box_BoxBegin ("100%",Txt_TIMETABLE_TYPES[Timetable.Type], Box_BoxBegin ("100%",Txt_TIMETABLE_TYPES[Timetable.Type],
NULL,NULL, NULL,NULL,
Help[Timetable.Type],Box_NOT_CLOSABLE); NULL,Box_NOT_CLOSABLE);
/***** Begin time table drawing *****/ /***** Begin time table drawing *****/
if (Timetable.Type == Tmt_COURSE_TIMETABLE) if (Timetable.Type == Tmt_COURSE_TIMETABLE)
@ -519,27 +519,28 @@ void Tmt_ShowTimeTable (struct Tmt_Timetable *Timetable,long UsrCod)
extern const char *Txt_The_timetable_is_empty; extern const char *Txt_The_timetable_is_empty;
/***** Set type of view depending on current action *****/ /***** Set type of view depending on current action *****/
Timetable->View = Tmt_CRS_VIEW; Timetable->View = Vie_VIEW;
switch (Gbl.Action.Act) switch (Gbl.Action.Act)
{ {
case ActSeeCrsTT: case ActPrnCrsTT: case ActChgCrsTT1stDay: case ActSeeCrsTT: case ActChgCrsTT1stDay:
case ActSeeMyTT: case ActPrnMyTT: case ActChgMyTT1stDay: case ActSeeMyTT: case ActChgMyTT1stDay:
Timetable->View = Tmt_CRS_VIEW; case ActSeeRecOneTch:
break; case ActSeeRecSevTch:
case ActSeeRecOneTch: case ActSeeRecSevTch: Timetable->View = Vie_VIEW;
Timetable->View = Tmt_TUT_VIEW;
break; break;
case ActEdiCrsTT: case ActChgCrsTT: case ActEdiCrsTT: case ActChgCrsTT:
Timetable->View = Tmt_CRS_EDIT;
break;
case ActEdiTut: case ActChgTut: case ActEdiTut: case ActChgTut:
Timetable->View = Tmt_TUT_EDIT; Timetable->View = Vie_EDIT;
break;
case ActPrnCrsTT:
case ActPrnMyTT:
case ActPrnRecSevTch:
Timetable->View = Vie_PRINT;
break; break;
} }
/***** If editing ==> configure and allocate timetable *****/ /***** If editing ==> configure and allocate timetable *****/
if (Timetable->View == Tmt_CRS_EDIT || if (Timetable->View == Vie_EDIT)
Timetable->View == Tmt_TUT_EDIT)
{ {
Timetable->Config.Range.Hours.Start = Tmt_START_HOUR; // Day starts at this hour Timetable->Config.Range.Hours.Start = Tmt_START_HOUR; // Day starts at this hour
Timetable->Config.Range.Hours.End = Tmt_END_HOUR; // Day ends at this hour Timetable->Config.Range.Hours.End = Tmt_END_HOUR; // Day ends at this hour
@ -692,10 +693,9 @@ static void Tmt_FillTimeTableFromDB (struct Tmt_Timetable *Timetable,
/***** Get timetable from database *****/ /***** Get timetable from database *****/
NumRows = Tmt_DB_GetTimeTable (&mysql_res,Timetable->Type,UsrCod); NumRows = Tmt_DB_GetTimeTable (&mysql_res,Timetable->Type,UsrCod);
/***** If viewing (not editing) ==> /***** If viewing of printing (not editing) ==>
calculate range of hours and resolution *****/ calculate range of hours and resolution *****/
if (Timetable->View == Tmt_CRS_VIEW || if (Timetable->View != Vie_EDIT)
Timetable->View == Tmt_TUT_VIEW)
{ {
/* Initialize hours and resolution for timetable */ /* Initialize hours and resolution for timetable */
Timetable->Config.Range.Hours.Start = Tmt_END_HOUR; // Initialized to maximum hour Timetable->Config.Range.Hours.Start = Tmt_END_HOUR; // Initialized to maximum hour
@ -1007,9 +1007,15 @@ static void Tmt_DrawTimeTable (const struct Tmt_Timetable *Timetable)
unsigned ColumnsToDraw; unsigned ColumnsToDraw;
unsigned ColumnsToDrawIncludingExtraColumn; unsigned ColumnsToDrawIncludingExtraColumn;
unsigned ContinuousFreeMinicolumns; unsigned ContinuousFreeMinicolumns;
static const char *TableClass[Vie_NUM_VIEW_TYPES] =
{
[Vie_VIEW ] = "TBL_SCROLL",
[Vie_EDIT ] = "TBL_SCROLL",
[Vie_PRINT] = "TT",
};
/***** Begin table *****/ /***** Begin table *****/
HTM_TABLE_Begin ("TT"); HTM_TABLE_Begin (TableClass[Timetable->View]);
/***** Top row used for column adjustement *****/ /***** Top row used for column adjustement *****/
Tmt_TimeTableDrawAdjustRow (); Tmt_TimeTableDrawAdjustRow ();
@ -1064,15 +1070,13 @@ static void Tmt_DrawTimeTable (const struct Tmt_Timetable *Timetable)
true, // Top call, non recursive true, // Top call, non recursive
WhichCell.Weekday,WhichCell.Interval); WhichCell.Weekday,WhichCell.Interval);
if (ColumnsToDraw == 0 && if (ColumnsToDraw == 0 &&
(Timetable->View == Tmt_CRS_VIEW || Timetable->View != Vie_EDIT)
Timetable->View == Tmt_TUT_VIEW))
ColumnsToDraw = 1; ColumnsToDraw = 1;
// If editing and there's place for more columns, // If editing and there's place for more columns,
// a potential new column is added at the end of each day // a potential new column is added at the end of each day
ColumnsToDrawIncludingExtraColumn = ColumnsToDraw; ColumnsToDrawIncludingExtraColumn = ColumnsToDraw;
if (ColumnsToDraw < Tmt_MAX_COLUMNS_PER_CELL && if (ColumnsToDraw < Tmt_MAX_COLUMNS_PER_CELL &&
(Timetable->View == Tmt_CRS_EDIT || Timetable->View == Vie_EDIT)
Timetable->View == Tmt_TUT_EDIT))
ColumnsToDrawIncludingExtraColumn++; ColumnsToDrawIncludingExtraColumn++;
/* Draw cells */ /* Draw cells */
@ -1395,26 +1399,19 @@ static void Tmt_TimeTableDrawCell (const struct Tmt_Timetable *Timetable,
free (ClassStr); free (ClassStr);
/***** Draw cell depending on type of view *****/ /***** Draw cell depending on type of view *****/
switch (Timetable->View) if (Timetable->View == Vie_EDIT) // Editing
{ Tmt_TimeTableDrawCellEdit (Timetable,WhichCell,
case Tmt_CRS_VIEW: // View course timetable GrpCod,
case Tmt_TUT_VIEW: // View tutoring timetable IntervalType,ClassType,
if (IntervalType != Tmt_FREE_INTERVAL) // If cell is not empty... DurationNumIntervals,
Tmt_TimeTableDrawCellView (Timetable, Info);
CrsCod,GrpCod, else // Viewing or printing
ClassType, if (IntervalType != Tmt_FREE_INTERVAL) // If cell is not empty...
DurationNumIntervals, Tmt_TimeTableDrawCellView (Timetable,
Info); CrsCod,GrpCod,
break; ClassType,
case Tmt_CRS_EDIT: // Edit course timetable DurationNumIntervals,
case Tmt_TUT_EDIT: // Edit tutoring timetable Info);
Tmt_TimeTableDrawCellEdit (Timetable,WhichCell,
GrpCod,
IntervalType,ClassType,
DurationNumIntervals,
Info);
break;
}
/***** End cell *****/ /***** End cell *****/
HTM_TD_End (); HTM_TD_End ();
@ -1455,8 +1452,7 @@ static void Tmt_TimeTableDrawCellView (const struct Tmt_Timetable *Timetable,
Timetable->Config.Range.MinutesPerInterval); // Minutes Timetable->Config.Range.MinutesPerInterval); // Minutes
/***** Group *****/ /***** Group *****/
if (Timetable->View == Tmt_CRS_VIEW && if (GrpCod > 0 && Timetable->Type != Tmt_TUTORING_TIMETABLE)
GrpCod > 0)
{ {
GrpDat.GrpCod = GrpCod; GrpDat.GrpCod = GrpCod;
Grp_GetGroupDataByCod (&GrpDat); Grp_GetGroupDataByCod (&GrpDat);
@ -1495,12 +1491,11 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable,
extern const char *Txt_Group; extern const char *Txt_Group;
extern const char *Txt_All_groups; extern const char *Txt_All_groups;
extern const char *Txt_Info; extern const char *Txt_Info;
static const Act_Action_t NextAction[Tmt_NUM_VIEW_EDIT] = static const Act_Action_t NextAction[Tmt_NUM_TIMETABLE_TYPES] =
{ {
[Tmt_CRS_VIEW] = ActUnk, // course view [Tmt_COURSE_TIMETABLE ] = ActChgCrsTT,
[Tmt_TUT_VIEW] = ActUnk, // tutorials view [Tmt_MY_TIMETABLE ] = ActChgTut,
[Tmt_CRS_EDIT] = ActChgCrsTT, // course edit [Tmt_TUTORING_TIMETABLE] = ActChgTut,
[Tmt_TUT_EDIT] = ActChgTut, // tutorials edit
}; };
char *CellStr; // Unique string for this cell used in labels char *CellStr; // Unique string for this cell used in labels
Tmt_ClassType_t CT; Tmt_ClassType_t CT;
@ -1515,7 +1510,7 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable,
char *Room; char *Room;
/***** Form to modify this cell *****/ /***** Form to modify this cell *****/
Frm_BeginForm (NextAction[Timetable->View]); Frm_BeginForm (NextAction[Timetable->Type]);
/***** Put hidden parameters *****/ /***** Put hidden parameters *****/
Par_PutParUnsigned (NULL,"TTDay",WhichCell->Weekday ); Par_PutParUnsigned (NULL,"TTDay",WhichCell->Weekday );
@ -1530,8 +1525,8 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable,
CT <= (Tmt_ClassType_t) (Tmt_NUM_CLASS_TYPES - 1); CT <= (Tmt_ClassType_t) (Tmt_NUM_CLASS_TYPES - 1);
CT++) CT++)
if ((CT == Tmt_FREE) || if ((CT == Tmt_FREE) ||
((Timetable->View == Tmt_CRS_EDIT) && (CT == Tmt_LECTURE || CT == Tmt_PRACTICAL)) || ((Timetable->Type == Tmt_COURSE_TIMETABLE ) && (CT == Tmt_LECTURE || CT == Tmt_PRACTICAL)) ||
((Timetable->View == Tmt_TUT_EDIT) && (CT == Tmt_TUTORING))) ((Timetable->Type == Tmt_TUTORING_TIMETABLE) && (CT == Tmt_TUTORING)))
HTM_OPTION (HTM_Type_STRING,Tmt_DB_ClassType[CT], HTM_OPTION (HTM_Type_STRING,Tmt_DB_ClassType[CT],
CT == ClassType ? HTM_OPTION_SELECTED : CT == ClassType ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED, HTM_OPTION_UNSELECTED,
@ -1597,7 +1592,7 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable,
WhichCell->Column) < 0) WhichCell->Column) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
if (Timetable->View == Tmt_CRS_EDIT) if (Timetable->Type == Tmt_COURSE_TIMETABLE)
{ {
/***** Group *****/ /***** Group *****/
HTM_BR (); HTM_BR ();
@ -1658,7 +1653,7 @@ static void Tmt_TimeTableDrawCellEdit (const struct Tmt_Timetable *Timetable,
" class=\"Tmt_INF INPUT_%s\"", " class=\"Tmt_INF INPUT_%s\"",
CellStr,The_GetSuffix ()); CellStr,The_GetSuffix ());
} }
else // TimeTableView == Tmt_TUT_EDIT else // Timetable->Type != Tmt_COURSE_TIMETABLE
{ {
/***** Info *****/ /***** Info *****/
HTM_BR (); HTM_BR ();

View File

@ -36,15 +36,6 @@
#define Tmt_MAX_CHARS_INFO (128 - 1) // 127 #define Tmt_MAX_CHARS_INFO (128 - 1) // 127
#define Tmt_MAX_BYTES_INFO ((Tmt_MAX_CHARS_INFO + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 #define Tmt_MAX_BYTES_INFO ((Tmt_MAX_CHARS_INFO + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
#define Tmt_NUM_VIEW_EDIT 4
typedef enum
{
Tmt_CRS_VIEW = 0, // course view
Tmt_TUT_VIEW = 1, // tutorials view
Tmt_CRS_EDIT = 2, // course edit
Tmt_TUT_EDIT = 3, // tutorials edit
} Tmt_TimeTableView_t;
#define Tmt_NUM_TIMETABLE_TYPES 3 #define Tmt_NUM_TIMETABLE_TYPES 3
typedef enum typedef enum
{ {
@ -98,7 +89,7 @@ struct Tmt_Timetable
unsigned IntervalsBeforeStartHour; unsigned IntervalsBeforeStartHour;
} Config; } Config;
Tmt_TimeTableType_t Type; Tmt_TimeTableType_t Type;
Tmt_TimeTableView_t View; Vie_ViewType_t View;
struct Tmt_WhichCell WhichCell; struct Tmt_WhichCell WhichCell;
Tmt_ClassType_t ClassType; Tmt_ClassType_t ClassType;
unsigned DurationIntervals; unsigned DurationIntervals;