Version 18.27.3

This commit is contained in:
Antonio Cañas Vargas 2019-01-03 16:01:29 +01:00
parent cd38bd567f
commit 434a846f84
2 changed files with 41 additions and 23 deletions

View File

@ -364,10 +364,12 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 18.27.2 (2019-01-03)" #define Log_PLATFORM_VERSION "SWAD 18.27.3 (2019-01-03)"
#define CSS_FILE "swad18.22.css" #define CSS_FILE "swad18.22.css"
#define JS_FILE "swad17.17.1.js" #define JS_FILE "swad17.17.1.js"
/* /*
Version 18.27.3: Jan 03, 2019 Rows in colors in listing of classrooms.
Fixed bugs in classrooms. (238860 lines)
Version 18.27.2: Jan 03, 2019 Short name and full name in listing of classrooms. (238847 lines) Version 18.27.2: Jan 03, 2019 Short name and full name in listing of classrooms. (238847 lines)
Version 18.27.1: Jan 03, 2019 New field in forms of classrooms for location. (238800 lines) Version 18.27.1: Jan 03, 2019 New field in forms of classrooms for location. (238800 lines)
1 change necessary in database: 1 change necessary in database:

View File

@ -89,6 +89,7 @@ void Cla_SeeClassrooms (void)
extern const char *Txt_New_classroom; extern const char *Txt_New_classroom;
Cla_Order_t Order; Cla_Order_t Order;
unsigned NumCla; unsigned NumCla;
unsigned RowEvenOdd;
if (Gbl.CurrentCtr.Ctr.CtrCod > 0) if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
{ {
@ -122,29 +123,39 @@ void Cla_SeeClassrooms (void)
} }
fprintf (Gbl.F.Out,"</tr>"); fprintf (Gbl.F.Out,"</tr>");
/***** Write all classrooms and their maximum of students *****/ /***** Write list of classrooms *****/
for (NumCla = 0; for (NumCla = 0, RowEvenOdd = 1;
NumCla < Gbl.Classrooms.Num; NumCla < Gbl.Classrooms.Num;
NumCla++) NumCla++, RowEvenOdd = 1 - RowEvenOdd)
{ {
/* Write data of this classroom */ /* Short name */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"DAT LEFT_MIDDLE\">" "<td class=\"DAT LEFT_MIDDLE %s\">"
"%s" "%s"
"</td>" "</td>",
"<td class=\"DAT LEFT_MIDDLE\">" Gbl.ColorRows[RowEvenOdd],
Gbl.Classrooms.Lst[NumCla].ShrtName);
/* Full name */
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE %s\">"
"%s" "%s"
"</td>" "</td>",
"<td class=\"DAT RIGHT_MIDDLE\">", Gbl.ColorRows[RowEvenOdd],
Gbl.Classrooms.Lst[NumCla].ShrtName,
Gbl.Classrooms.Lst[NumCla].FullName); Gbl.Classrooms.Lst[NumCla].FullName);
/* Capacity */
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE %s\">",
Gbl.ColorRows[RowEvenOdd]);
Cla_WriteCapacity (Gbl.Classrooms.Lst[NumCla].Capacity); Cla_WriteCapacity (Gbl.Classrooms.Lst[NumCla].Capacity);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>");
"<td class=\"DAT LEFT_MIDDLE\">"
/* Location */
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE %s\">"
"%s" "%s"
"</td>" "</td>"
"</tr>", "</tr>",
Gbl.Classrooms.Lst[NumCla].Location); Gbl.ColorRows[RowEvenOdd],
Gbl.Classrooms.Lst[NumCla].Location);
} }
/***** End table *****/ /***** End table *****/
@ -185,7 +196,7 @@ static void Cla_GetParamClaOrder (void)
static bool Cla_CheckIfICanCreateClassrooms (void) static bool Cla_CheckIfICanCreateClassrooms (void)
{ {
return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_INS_ADM); return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -529,24 +540,26 @@ long Cla_GetParamClaCod (void)
void Cla_RemoveClassroom (void) void Cla_RemoveClassroom (void)
{ {
extern const char *Txt_Classroom_X_removed; extern const char *Txt_Classroom_X_removed;
struct Classroom Cla; struct Classroom *Cla;
Cla = &Gbl.Classrooms.EditingCla;
/***** Get classroom code *****/ /***** Get classroom code *****/
if ((Cla.ClaCod = Cla_GetParamClaCod ()) == -1L) if ((Cla->ClaCod = Cla_GetParamClaCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of classroom is missing."); Lay_ShowErrorAndExit ("Code of classroom is missing.");
/***** Get data of the classroom from database *****/ /***** Get data of the classroom from database *****/
Cla_GetDataOfClassroomByCod (&Cla); Cla_GetDataOfClassroomByCod (Cla);
/***** Remove classroom *****/ /***** Remove classroom *****/
DB_QueryDELETE ("can not remove a classroom", DB_QueryDELETE ("can not remove a classroom",
"DELETE FROM classrooms WHERE ClaCod=%ld", "DELETE FROM classrooms WHERE ClaCod=%ld",
Cla.ClaCod); Cla->ClaCod);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),
Txt_Classroom_X_removed, Txt_Classroom_X_removed,
Cla.FullName); Cla->FullName);
Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt); Ale_ShowAlert (Ale_SUCCESS,Gbl.Alert.Txt);
/***** Show the form again *****/ /***** Show the form again *****/
@ -957,6 +970,9 @@ void Cla_RecFormNewClassroom (void)
Cla_MAX_CAPACITY, Cla_MAX_CAPACITY,
Cla_UNLIMITED_CAPACITY); Cla_UNLIMITED_CAPACITY);
/* Get classroom location */
Par_GetParToText ("Location",Cla->Location,Cla_MAX_BYTES_LOCATION);
if (Cla->ShrtName[0] && Cla->FullName[0]) // If there's a classroom name if (Cla->ShrtName[0] && Cla->FullName[0]) // If there's a classroom name
{ {
/***** If name of classroom was in database... *****/ /***** If name of classroom was in database... *****/
@ -995,11 +1011,11 @@ static void Cla_CreateClassroom (struct Classroom *Cla)
/***** Create a new classroom *****/ /***** Create a new classroom *****/
DB_QueryINSERT ("can not create classroom", DB_QueryINSERT ("can not create classroom",
"INSERT INTO classrooms" "INSERT INTO classrooms"
" (CtrCod,ShortName,FullName,Capacity)" " (CtrCod,ShortName,FullName,Capacity,Location)"
" VALUES" " VALUES"
" (%ld,'%s','%s',%u)", " (%ld,'%s','%s',%u,'%s')",
Gbl.CurrentCtr.Ctr.CtrCod, Gbl.CurrentCtr.Ctr.CtrCod,
Cla->ShrtName,Cla->FullName,Cla->Capacity); Cla->ShrtName,Cla->FullName,Cla->Capacity,Cla->Location);
/***** Write success message *****/ /***** Write success message *****/
snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt),