Version19.54.4

This commit is contained in:
Antonio Cañas Vargas 2019-11-06 08:59:15 +01:00
parent 3888810401
commit 8620baa373
10 changed files with 106 additions and 133 deletions

View File

@ -490,7 +490,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.54.3 (2019-11-06)"
#define Log_PLATFORM_VERSION "SWAD 19.54.4 (2019-11-06)"
#define CSS_FILE "swad19.47.css"
#define JS_FILE "swad19.39.js"
/*
@ -498,6 +498,7 @@ ps2pdf source.ps destination.pdf
// TODO: Impedir la creación y edición de proyectos si no son editables.
// TODO: Importante: filtrar proyectos por usuarios (igual que en trabajos o en asistencia)
Version 19.54.4: Nov 05, 2019 Code refactoring in HTML select options. (246023 lines)
Version 19.54.3: Nov 05, 2019 Code refactoring in HTML select options. (246050 lines)
Version 19.54.2: Nov 06, 2019 Fixed bug in dates form. (246055 lines)
Version 19.54.1: Nov 05, 2019 Fixed bug in assignments, reported by Eva Martínez Ortigosa. (246054 lines)

View File

@ -1234,11 +1234,8 @@ void Cty_WriteSelectorOfCountry (void)
Frm_StartFormGoTo (ActSeeIns);
HTM_SELECT_Begin (true,
"id=\"cty\" name=\"cty\" class=\"HIE_SEL\"");
fprintf (Gbl.F.Out,"<option value=\"\"");
if (Gbl.Hierarchy.Cty.CtyCod < 0)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out," disabled=\"disabled\">[%s]</option>",
Txt_Country);
HTM_OPTION (HTM_Type_STRING,(void *) "",Gbl.Hierarchy.Cty.CtyCod < 0,true,
"[%s]",Txt_Country);
/***** Get countries from database *****/
NumCtys = (unsigned) DB_QuerySELECT (&mysql_res,"can not get countries",
@ -1261,10 +1258,9 @@ void Cty_WriteSelectorOfCountry (void)
Lay_ShowErrorAndExit ("Wrong code of country.");
/* Write option */
fprintf (Gbl.F.Out,"<option value=\"%ld\"",CtyCod);
if (CtyCod == Gbl.Hierarchy.Cty.CtyCod)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",row[1]);
HTM_OPTION (HTM_Type_LONG,(void *) &CtyCod,
CtyCod == Gbl.Hierarchy.Cty.CtyCod,false,
"%s",row[1]);
}
/***** Free structure that stores the query result *****/

View File

@ -259,11 +259,9 @@ static void Crs_Configuration (bool PrintView)
for (NumDeg = 0;
NumDeg < Gbl.Hierarchy.Ctr.Degs.Num;
NumDeg++)
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
Gbl.Hierarchy.Ctr.Degs.Lst[NumDeg].DegCod,
Gbl.Hierarchy.Ctr.Degs.Lst[NumDeg].DegCod == Gbl.Hierarchy.Deg.DegCod ? " selected=\"selected\"" :
"",
Gbl.Hierarchy.Ctr.Degs.Lst[NumDeg].ShrtName);
HTM_OPTION (HTM_Type_LONG,(void *) &Gbl.Hierarchy.Ctr.Degs.Lst[NumDeg].DegCod,
Gbl.Hierarchy.Ctr.Degs.Lst[NumDeg].DegCod == Gbl.Hierarchy.Deg.DegCod,false,
"%s",Gbl.Hierarchy.Ctr.Degs.Lst[NumDeg].ShrtName);
HTM_SELECT_End ();
Frm_EndForm ();
@ -348,11 +346,9 @@ static void Crs_Configuration (bool PrintView)
for (Year = 0;
Year <= Deg_MAX_YEARS_PER_DEGREE;
Year++)
fprintf (Gbl.F.Out,"<option value=\"%u\"%s>%s</option>",
Year,
Year == Gbl.Hierarchy.Crs.Year ? " selected=\"selected\"" :
"",
Txt_YEAR_OF_DEGREE[Year]);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &Year,
Year == Gbl.Hierarchy.Crs.Year,false,
"%s",Txt_YEAR_OF_DEGREE[Year]);
HTM_SELECT_End ();
Frm_EndForm ();
}
@ -891,11 +887,8 @@ void Crs_WriteSelectorOfCourse (void)
HTM_SELECT_Begin (false,
"id=\"crs\" name=\"crs\" class=\"HIE_SEL\""
" disabled=\"disabled\"");
fprintf (Gbl.F.Out,"<option value=\"\"");
if (Gbl.Hierarchy.Crs.CrsCod < 0)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out," disabled=\"disabled\">[%s]</option>",
Txt_Course);
HTM_OPTION (HTM_Type_STRING,(void *) "",Gbl.Hierarchy.Crs.CrsCod < 0,true,
"[%s]",Txt_Course);
if (Gbl.Hierarchy.Deg.DegCod > 0)
{
@ -920,11 +913,10 @@ void Crs_WriteSelectorOfCourse (void)
Lay_ShowErrorAndExit ("Wrong course.");
/* Write option */
fprintf (Gbl.F.Out,"<option value=\"%ld\"",CrsCod);
if (Gbl.Hierarchy.Level == Hie_CRS && // Course selected
(CrsCod == Gbl.Hierarchy.Crs.CrsCod))
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",row[1]);
HTM_OPTION (HTM_Type_LONG,(void *) &CrsCod,
Gbl.Hierarchy.Level == Hie_CRS && // Course selected
CrsCod == Gbl.Hierarchy.Crs.CrsCod,false,
"%s",row[1]);
}
/***** Free structure that stores the query result *****/
@ -1062,11 +1054,8 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void)
/***** Write an option when no course selected *****/
if (Gbl.Hierarchy.Crs.CrsCod <= 0) // No course selected
fprintf (Gbl.F.Out,"<option value=\"-1\""
" disabled=\"disabled\" selected=\"selected\">"
"%s"
"</option>",
Txt_Course);
HTM_OPTION (HTM_Type_STRING,(void *) "-1",true,true,
"%s",Txt_Course);
if (Gbl.Usrs.Me.MyCrss.Num)
{
@ -1088,11 +1077,9 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void)
LastDegCod = DegCod;
}
fprintf (Gbl.F.Out,"<option value=\"%ld\"",
Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod);
if (CrsCod == Gbl.Hierarchy.Crs.CrsCod) // Course selected
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",CrsShortName);
HTM_OPTION (HTM_Type_LONG,(void *) &Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod,
CrsCod == Gbl.Hierarchy.Crs.CrsCod,false, // Course selected
"%s",CrsShortName);
}
if (LastDegCod > 0)
@ -1103,12 +1090,8 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void)
when I don't belong to it *****/
if (Gbl.Hierarchy.Level == Hie_CRS && // Course selected
!Gbl.Usrs.Me.IBelongToCurrentCrs) // I do not belong to it
fprintf (Gbl.F.Out,"<option value=\"%ld\""
" disabled=\"disabled\" selected=\"selected\">"
"%s"
"</option>",
Gbl.Hierarchy.Crs.CrsCod,
Gbl.Hierarchy.Crs.ShrtName);
HTM_OPTION (HTM_Type_LONG,(void *) &Gbl.Hierarchy.Crs.CrsCod,true,true,
"%s",Gbl.Hierarchy.Crs.ShrtName);
/***** End form *****/
HTM_SELECT_End ();
@ -1424,6 +1407,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
struct UsrData UsrDat;
bool ICanEdit;
Crs_StatusTxt_t StatusTxt;
unsigned Status;
/***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat);
@ -1485,11 +1469,9 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
for (YearAux = 0;
YearAux <= Deg_MAX_YEARS_PER_DEGREE;
YearAux++) // All the years are permitted because it's possible to move this course to another degree (with other active years)
fprintf (Gbl.F.Out,"<option value=\"%u\"%s>%s</option>",
YearAux,
YearAux == Crs->Year ? " selected=\"selected\"" :
"",
Txt_YEAR_OF_DEGREE[YearAux]);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &YearAux,
YearAux == Crs->Year,false,
"%s",Txt_YEAR_OF_DEGREE[YearAux]);
HTM_SELECT_End ();
Frm_EndForm ();
}
@ -1553,12 +1535,15 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
Crs_PutParamOtherCrsCod (Crs->CrsCod);
HTM_SELECT_Begin (true,
"name=\"Status\" class=\"INPUT_STATUS\"");
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>"
"<option value=\"%u\">%s</option>",
(unsigned) Crs_GetStatusBitsFromStatusTxt (Crs_STATUS_PENDING),
Txt_COURSE_STATUS[Crs_STATUS_PENDING],
(unsigned) Crs_GetStatusBitsFromStatusTxt (Crs_STATUS_ACTIVE),
Txt_COURSE_STATUS[Crs_STATUS_ACTIVE]);
Status = (unsigned) Crs_GetStatusBitsFromStatusTxt (Crs_STATUS_PENDING);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &Status,true,false,
"%s",Txt_COURSE_STATUS[Crs_STATUS_PENDING]);
Status = (unsigned) Crs_GetStatusBitsFromStatusTxt (Crs_STATUS_ACTIVE);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &Status,false,false,
"%s",Txt_COURSE_STATUS[Crs_STATUS_ACTIVE]);
HTM_SELECT_End ();
Frm_EndForm ();
}
@ -1677,11 +1662,9 @@ static void Crs_PutFormToCreateCourse (void)
for (Year = 0;
Year <= Deg_MAX_YEARS_PER_DEGREE;
Year++)
fprintf (Gbl.F.Out,"<option value=\"%u\"%s>%s</option>",
Year,
Year == Crs_EditingCrs->Year ? " selected=\"selected\"" :
"",
Txt_YEAR_OF_DEGREE[Year]);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &Year,
Year == Crs_EditingCrs->Year,false,
"%s",Txt_YEAR_OF_DEGREE[Year]);
HTM_SELECT_End ();
HTM_TD_End ();
@ -3292,12 +3275,9 @@ void Crs_AskRemoveOldCrss (void)
for (i = Crs_MIN_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS;
i <= Crs_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_CRSS;
i++)
{
fprintf (Gbl.F.Out,"<option");
if (i == MonthsWithoutAccess)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%u</option>",i);
}
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &i,
i == MonthsWithoutAccess,false,
"%u",i);
HTM_SELECT_End ();
fprintf (Gbl.F.Out,"&nbsp;");
fprintf (Gbl.F.Out,Txt_Eliminate_all_courses_whithout_users_PART_2_OF_2,

View File

@ -114,6 +114,7 @@ void Lan_PutSelectorToSelectLanguage (void)
{
extern const char *Txt_STR_LANG_NAME[1 + Lan_NUM_LANGUAGES];
Lan_Language_t Lan;
unsigned LanUnsigned;
Frm_StartForm (ActReqChgLan);
HTM_SELECT_Begin (true,
@ -122,10 +123,10 @@ void Lan_PutSelectorToSelectLanguage (void)
Lan <= Lan_NUM_LANGUAGES;
Lan++)
{
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Lan);
if (Lan == Gbl.Prefs.Language)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",Txt_STR_LANG_NAME[Lan]);
LanUnsigned = (unsigned) Lan;
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &LanUnsigned,
Lan == Gbl.Prefs.Language,false,
"%s",Txt_STR_LANG_NAME[Lan]);
}
HTM_SELECT_End ();
Frm_EndForm ();

View File

@ -2618,21 +2618,17 @@ void Msg_ShowFormSelectCourseSentOrRecMsgs (void)
fprintf (Gbl.F.Out,"%s&nbsp;",TxtSelector[Gbl.Msg.TypeOfMessages]);
HTM_SELECT_Begin (false,
"name=\"FilterCrsCod\"");
fprintf (Gbl.F.Out,"<option value=\"\"");
if (Gbl.Msg.FilterCrsCod < 0)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",Txt_any_course);
HTM_OPTION (HTM_Type_STRING,(void *) "",
Gbl.Msg.FilterCrsCod < 0,false,
"%s",Txt_any_course);
/***** Write an option for each user's course *****/
/***** Write an option for each origin course *****/
for (NumOriginCrs = 0;
NumOriginCrs < Gbl.Msg.NumCourses;
NumOriginCrs++)
{
fprintf (Gbl.F.Out,"<option value=\"%ld\"",Gbl.Msg.Courses[NumOriginCrs].CrsCod);
if (Gbl.Msg.Courses[NumOriginCrs].CrsCod == Gbl.Msg.FilterCrsCod)
fprintf (Gbl.F.Out," selected=\"selected\""); // Select origin course
fprintf (Gbl.F.Out,">%s</option>",Gbl.Msg.Courses[NumOriginCrs].ShrtName);
}
HTM_OPTION (HTM_Type_LONG,(void *) &Gbl.Msg.Courses[NumOriginCrs].CrsCod,
Gbl.Msg.Courses[NumOriginCrs].CrsCod == Gbl.Msg.FilterCrsCod,false,
"%s",Gbl.Msg.Courses[NumOriginCrs].ShrtName);
HTM_SELECT_End ();
HTM_LABEL_End ();
}

View File

@ -3343,17 +3343,10 @@ static void Prj_PutFormProject (struct Project *Prj,bool ItsANewProject)
HTM_TD_Begin ("class=\"LM\"");
HTM_SELECT_Begin (false,
"name=\"Assigned\"");
fprintf (Gbl.F.Out,"<option value=\"Y\"");
if (Prj->Assigned == Prj_ASSIGNED)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",Txt_Yes);
fprintf (Gbl.F.Out,"<option value=\"N\"");
if (Prj->Assigned == Prj_NONASSIG)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",Txt_No);
HTM_OPTION (HTM_Type_STRING,(void *) "Y",Prj->Assigned == Prj_ASSIGNED,false,
"%s",Txt_Yes);
HTM_OPTION (HTM_Type_STRING,(void *) "N",Prj->Assigned == Prj_NONASSIG,false,
"%s",Txt_No);
HTM_SELECT_End ();
HTM_TD_End ();

View File

@ -471,6 +471,7 @@ void Rol_PutFormToChangeMyRole (const char *ClassSelect)
{
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
Rol_Role_t Role;
unsigned RoleUnsigned;
bool PutClassSelect;
Frm_StartForm (ActChgMyRol);
@ -489,11 +490,10 @@ void Rol_PutFormToChangeMyRole (const char *ClassSelect)
Role++)
if (Gbl.Usrs.Me.Role.Available & (1 << Role))
{
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Role);
if (Role == Gbl.Usrs.Me.Role.Logged)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",
Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
RoleUnsigned = (unsigned) Role;
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &RoleUnsigned,
Role == Gbl.Usrs.Me.Role.Logged,false,
"%s",Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
}
HTM_SELECT_End ();
Frm_EndForm ();

View File

@ -72,6 +72,7 @@ void Sco_PutSelectorScope (const char *ParamName,bool SendOnChange)
extern const char *Txt_Degree;
extern const char *Txt_Course;
Hie_Level_t Scope;
unsigned ScopeUnsigned;
bool WriteScope;
HTM_SELECT_Begin (SendOnChange,
@ -117,46 +118,55 @@ void Sco_PutSelectorScope (const char *ParamName,bool SendOnChange)
if (WriteScope)
{
/***** Write allowed option *****/
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Scope);
if (Gbl.Scope.Current == Scope)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">");
ScopeUnsigned = (unsigned) Scope;
switch (Scope)
{
case Hie_SYS:
fprintf (Gbl.F.Out,"%s: %s",
Txt_System,Cfg_PLATFORM_SHORT_NAME);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &ScopeUnsigned,
Gbl.Scope.Current == Scope,false,
"%s: %s",
Txt_System,
Cfg_PLATFORM_SHORT_NAME);
break;
case Hie_CTY:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Country,
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &ScopeUnsigned,
Gbl.Scope.Current == Scope,false,
"%s: %s",
Txt_Country,
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
break;
case Hie_INS:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Institution,
Gbl.Hierarchy.Ins.ShrtName);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &ScopeUnsigned,
Gbl.Scope.Current == Scope,false,
"%s: %s",
Txt_Institution,
Gbl.Hierarchy.Ins.ShrtName);
break;
case Hie_CTR:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Centre,
Gbl.Hierarchy.Ctr.ShrtName);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &ScopeUnsigned,
Gbl.Scope.Current == Scope,false,
"%s: %s",
Txt_Centre,
Gbl.Hierarchy.Ctr.ShrtName);
break;
case Hie_DEG:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Degree,
Gbl.Hierarchy.Deg.ShrtName);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &ScopeUnsigned,
Gbl.Scope.Current == Scope,false,
"%s: %s",
Txt_Degree,
Gbl.Hierarchy.Deg.ShrtName);
break;
case Hie_CRS:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Course,
Gbl.Hierarchy.Crs.ShrtName);
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &ScopeUnsigned,
Gbl.Scope.Current == Scope,false,
"%s: %s",
Txt_Course,
Gbl.Hierarchy.Crs.ShrtName);
break;
default:
Lay_WrongScopeExit ();
break;
}
fprintf (Gbl.F.Out,"</option>");
}
}

View File

@ -132,6 +132,7 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Hie
Txt_my_documents, // Sch_SEARCH_MY_DOCUMENTS
};
Sch_WhatToSearch_t WhatToSearch;
unsigned WTS;
/***** Begin box *****/
HTM_DIV_Begin ("class=\"CM\"");
@ -171,12 +172,10 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Hie
WhatToSearch++)
if (Sch_CheckIfIHavePermissionToSearch (WhatToSearch))
{
fprintf (Gbl.F.Out,"<option value=\"%u\"",
(unsigned) WhatToSearch);
if (Gbl.Search.WhatToSearch == WhatToSearch)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",
Titles[WhatToSearch]);
WTS = (unsigned) WhatToSearch;
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &WTS,
Gbl.Search.WhatToSearch == WhatToSearch,false,
"%s",Titles[WhatToSearch]);
}
HTM_SELECT_End ();
HTM_LABEL_End ();

View File

@ -8945,12 +8945,9 @@ void Usr_PutSelectorNumColsClassPhoto (void)
for (Cols = 1;
Cols <= Usr_CLASS_PHOTO_COLS_MAX;
Cols++)
{
fprintf (Gbl.F.Out,"<option");
if (Cols == Gbl.Usrs.ClassPhoto.Cols)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%u</option>",Cols);
}
HTM_OPTION (HTM_Type_UNSIGNED,(void *) &Cols,
Cols == Gbl.Usrs.ClassPhoto.Cols,false,
"%u",Cols);
/***** End selector *****/
HTM_SELECT_End ();