Version19.85

This commit is contained in:
Antonio Cañas Vargas 2019-12-06 22:18:05 +01:00
parent 2a4844e937
commit fa8bcbb819
6 changed files with 102 additions and 130 deletions

View File

@ -1823,7 +1823,7 @@ a:hover /* Default ==> underlined */
{ {
box-sizing:border-box; box-sizing:border-box;
width:100%; width:100%;
margin-bottom:20px; margin-bottom:10px;
} }
.FRAME_TBL_CENTER .FRAME_TBL_CENTER
{ {
@ -1832,7 +1832,7 @@ a:hover /* Default ==> underlined */
.FRAME_TBL_CENTER_MARGIN .FRAME_TBL_CENTER_MARGIN
{ {
margin:0 auto; margin:0 auto;
margin-bottom:20px; margin-bottom:10px;
} }
.FRAME_TITLE .FRAME_TITLE
{ {

View File

@ -138,12 +138,6 @@ static void Asg_ShowAllAssignments (void)
Pag_CalculatePagination (&Pagination); Pag_CalculatePagination (&Pagination);
Gbl.Asgs.CurrentPage = (unsigned) Pagination.CurrentPage; Gbl.Asgs.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,
0,
&Pagination);
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin ("100%",Txt_Assignments,Asg_PutIconsListAssignments, Box_BoxBegin ("100%",Txt_Assignments,Asg_PutIconsListAssignments,
Hlp_ASSESSMENT_Assignments,Box_NOT_CLOSABLE); Hlp_ASSESSMENT_Assignments,Box_NOT_CLOSABLE);
@ -156,6 +150,12 @@ static void Asg_ShowAllAssignments (void)
Set_EndSettingsHead (); Set_EndSettingsHead ();
} }
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,
0,
&Pagination);
if (Gbl.Asgs.Num) if (Gbl.Asgs.Num)
{ {
/***** Table head *****/ /***** Table head *****/
@ -175,6 +175,12 @@ static void Asg_ShowAllAssignments (void)
else // No assignments created else // No assignments created
Ale_ShowAlert (Ale_INFO,Txt_No_assignments); Ale_ShowAlert (Ale_INFO,Txt_No_assignments);
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,
0,
&Pagination);
/***** Button to create a new assignment *****/ /***** Button to create a new assignment *****/
if (Asg_CheckIfICanCreateAssignments ()) if (Asg_CheckIfICanCreateAssignments ())
Asg_PutButtonToCreateNewAsg (); Asg_PutButtonToCreateNewAsg ();
@ -182,12 +188,6 @@ static void Asg_ShowAllAssignments (void)
/***** End box *****/ /***** End box *****/
Box_BoxEnd (); Box_BoxEnd ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ASSIGNMENTS,
0,
&Pagination);
/***** Free list of assignments *****/ /***** Free list of assignments *****/
Asg_FreeListAssignments (); Asg_FreeListAssignments ();
} }

View File

@ -222,12 +222,6 @@ static void Att_ShowAllAttEvents (void)
Pag_CalculatePagination (&Pagination); Pag_CalculatePagination (&Pagination);
Gbl.AttEvents.CurrentPage = (unsigned) Pagination.CurrentPage; Gbl.AttEvents.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,
0,
&Pagination);
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin ("100%",Txt_Events,Att_PutIconsInListOfAttEvents, Box_BoxBegin ("100%",Txt_Events,Att_PutIconsInListOfAttEvents,
Hlp_USERS_Attendance,Box_NOT_CLOSABLE); Hlp_USERS_Attendance,Box_NOT_CLOSABLE);
@ -240,6 +234,12 @@ static void Att_ShowAllAttEvents (void)
Set_EndSettingsHead (); Set_EndSettingsHead ();
} }
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,
0,
&Pagination);
if (Gbl.AttEvents.Num) if (Gbl.AttEvents.Num)
{ {
/***** Table head *****/ /***** Table head *****/
@ -285,6 +285,12 @@ static void Att_ShowAllAttEvents (void)
else // No events created else // No events created
Ale_ShowAlert (Ale_INFO,Txt_No_events); Ale_ShowAlert (Ale_INFO,Txt_No_events);
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,
0,
&Pagination);
/***** Button to create a new attendance event *****/ /***** Button to create a new attendance event *****/
if (ICanEdit) if (ICanEdit)
Att_PutButtonToCreateNewAttEvent (); Att_PutButtonToCreateNewAttEvent ();
@ -292,12 +298,6 @@ static void Att_ShowAllAttEvents (void)
/***** End box *****/ /***** End box *****/
Box_BoxEnd (); Box_BoxEnd ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_ATT_EVENTS,
0,
&Pagination);
/***** Free list of attendance events *****/ /***** Free list of attendance events *****/
Att_FreeListAttEvents (); Att_FreeListAttEvents ();
} }

View File

@ -490,14 +490,16 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.84.3 (2019-12-06)" #define Log_PLATFORM_VERSION "SWAD 19.85 (2019-12-06)"
#define CSS_FILE "swad19.82.3.css" #define CSS_FILE "swad19.85.css"
#define JS_FILE "swad19.70.js" #define JS_FILE "swad19.70.js"
/* /*
// TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.)
// TODO: Impedir la creación y edición de proyectos si no son editables. // TODO: Impedir la creación y edición de proyectos si no son editables.
// TODO: En cada juego, poder listar los resultados en una tabla como la de resultados globales // TODO: En cada juego, poder listar los resultados en una tabla como la de resultados globales
Version 19.85: Dec 06, 2019 Changes in layout of pagination.
Code refactoring in surveys. (247855 lines)
Version 19.84.3: Dec 06, 2019 Contextual icon to show matches results. Version 19.84.3: Dec 06, 2019 Contextual icon to show matches results.
Fixed bug in matches results. (247875 lines) Fixed bug in matches results. (247875 lines)
Version 19.84.2: Dec 06, 2019 Contextual icon to show tests results. Version 19.84.2: Dec 06, 2019 Contextual icon to show tests results.

View File

@ -201,16 +201,16 @@ static void Gam_ListAllGames (void)
Pag_CalculatePagination (&Pagination); Pag_CalculatePagination (&Pagination);
Gbl.Games.CurrentPage = (unsigned) Pagination.CurrentPage; Gbl.Games.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Begin box *****/
Box_BoxBegin ("100%",Txt_Games,Gam_PutIconsListGames,
Hlp_ASSESSMENT_Games,Box_NOT_CLOSABLE);
/***** Write links to pages *****/ /***** Write links to pages *****/
if (Pagination.MoreThanOnePage) if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_GAMES, Pag_WriteLinksToPagesCentered (Pag_GAMES,
0, 0,
&Pagination); &Pagination);
/***** Begin box *****/
Box_BoxBegin ("100%",Txt_Games,Gam_PutIconsListGames,
Hlp_ASSESSMENT_Games,Box_NOT_CLOSABLE);
if (Gbl.Games.Num) if (Gbl.Games.Num)
{ {
/***** Table head *****/ /***** Table head *****/
@ -260,6 +260,12 @@ static void Gam_ListAllGames (void)
else // No games created else // No games created
Ale_ShowAlert (Ale_INFO,Txt_No_games); Ale_ShowAlert (Ale_INFO,Txt_No_games);
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_GAMES,
0,
&Pagination);
/***** Button to create a new game *****/ /***** Button to create a new game *****/
if (Gam_CheckIfICanEditGames ()) if (Gam_CheckIfICanEditGames ())
Gam_PutButtonToCreateNewGame (); Gam_PutButtonToCreateNewGame ();
@ -267,12 +273,6 @@ static void Gam_ListAllGames (void)
/***** End box *****/ /***** End box *****/
Box_BoxEnd (); Box_BoxEnd ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_GAMES,
0,
&Pagination);
/***** Free list of games *****/ /***** Free list of games *****/
Gam_FreeListGames (); Gam_FreeListGames ();
} }

View File

@ -96,15 +96,14 @@ long Svy_CurrentQstCod; // Used as parameter in contextual links
/***************************** Private prototypes ****************************/ /***************************** Private prototypes ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst); static void Svy_ListAllSurveys (void);
static bool Svy_CheckIfICanCreateSvy (void); static bool Svy_CheckIfICanCreateSvy (void);
static void Svy_PutIconsListSurveys (void); static void Svy_PutIconsListSurveys (void);
static void Svy_PutIconToCreateNewSvy (void); static void Svy_PutIconToCreateNewSvy (void);
static void Svy_PutButtonToCreateNewSvy (void); static void Svy_PutButtonToCreateNewSvy (void);
static void Svy_PutParamsToCreateNewSvy (void); static void Svy_PutParamsToCreateNewSvy (void);
static void Svy_ParamsWhichGroupsToShow (void); static void Svy_ParamsWhichGroupsToShow (void);
static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst, static void Svy_ShowOneSurvey (long SvyCod,bool ShowOnlyThisSvyComplete);
bool ShowOnlyThisSvyComplete);
static void Svy_WriteAuthor (struct Survey *Svy); static void Svy_WriteAuthor (struct Survey *Svy);
static void Svy_WriteStatus (struct Survey *Svy); static void Svy_WriteStatus (struct Survey *Svy);
static void Svy_GetParamSvyOrder (void); static void Svy_GetParamSvyOrder (void);
@ -153,8 +152,7 @@ static void Svy_FreeTextChoiceAnswer (struct SurveyQuestion *SvyQst,unsigned Num
static unsigned Svy_GetQstIndFromQstCod (long QstCod); static unsigned Svy_GetQstIndFromQstCod (long QstCod);
static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod); static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod);
static void Svy_ListSvyQuestions (struct Survey *Svy, static void Svy_ListSvyQuestions (struct Survey *Svy);
struct SurveyQuestion *SvyQst);
static void Svy_PutParamsToEditQuestion (void); static void Svy_PutParamsToEditQuestion (void);
static void Svy_PutIconToAddNewQuestion (void); static void Svy_PutIconToAddNewQuestion (void);
static void Svy_PutButtonToCreateNewQuestion (void); static void Svy_PutButtonToCreateNewQuestion (void);
@ -179,25 +177,20 @@ static unsigned Svy_GetNumUsrsWhoHaveAnsweredSvy (long SvyCod);
void Svy_SeeAllSurveys (void) void Svy_SeeAllSurveys (void)
{ {
struct SurveyQuestion SvyQst;
/***** Initialize question to zero *****/
Svy_InitQst (&SvyQst);
/***** Get parameters *****/ /***** Get parameters *****/
Svy_GetParamSvyOrder (); Svy_GetParamSvyOrder ();
Grp_GetParamWhichGrps (); Grp_GetParamWhichGrps ();
Gbl.Svys.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS); Gbl.Svys.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
/***** Show all surveys *****/ /***** Show all surveys *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys ();
} }
/*****************************************************************************/ /*****************************************************************************/
/*************************** Show all the surveys ****************************/ /*************************** Show all the surveys ****************************/
/*****************************************************************************/ /*****************************************************************************/
static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst) static void Svy_ListAllSurveys (void)
{ {
extern const char *Hlp_ASSESSMENT_Surveys; extern const char *Hlp_ASSESSMENT_Surveys;
extern const char *Txt_Surveys; extern const char *Txt_Surveys;
@ -223,12 +216,6 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst)
Pag_CalculatePagination (&Pagination); Pag_CalculatePagination (&Pagination);
Gbl.Svys.CurrentPage = (unsigned) Pagination.CurrentPage; Gbl.Svys.CurrentPage = (unsigned) Pagination.CurrentPage;
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,
0,
&Pagination);
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin ("100%",Txt_Surveys,Svy_PutIconsListSurveys, Box_BoxBegin ("100%",Txt_Surveys,Svy_PutIconsListSurveys,
Hlp_ASSESSMENT_Surveys,Box_NOT_CLOSABLE); Hlp_ASSESSMENT_Surveys,Box_NOT_CLOSABLE);
@ -241,6 +228,12 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst)
Set_EndSettingsHead (); Set_EndSettingsHead ();
} }
/***** Write links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,
0,
&Pagination);
if (Gbl.Svys.Num) if (Gbl.Svys.Num)
{ {
/***** Table head *****/ /***** Table head *****/
@ -278,11 +271,11 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst)
HTM_TR_End (); HTM_TR_End ();
/***** Write all the surveys *****/ /***** Write all surveys *****/
for (NumSvy = Pagination.FirstItemVisible; for (NumSvy = Pagination.FirstItemVisible;
NumSvy <= Pagination.LastItemVisible; NumSvy <= Pagination.LastItemVisible;
NumSvy++) NumSvy++)
Svy_ShowOneSurvey (Gbl.Svys.LstSvyCods[NumSvy - 1],SvyQst,false); Svy_ShowOneSurvey (Gbl.Svys.LstSvyCods[NumSvy - 1],false);
/***** End table *****/ /***** End table *****/
HTM_TABLE_End (); HTM_TABLE_End ();
@ -290,6 +283,12 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst)
else // No surveys created else // No surveys created
Ale_ShowAlert (Ale_INFO,Txt_No_surveys); Ale_ShowAlert (Ale_INFO,Txt_No_surveys);
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,
0,
&Pagination);
/***** Button to create a new survey *****/ /***** Button to create a new survey *****/
if (Svy_CheckIfICanCreateSvy ()) if (Svy_CheckIfICanCreateSvy ())
Svy_PutButtonToCreateNewSvy (); Svy_PutButtonToCreateNewSvy ();
@ -297,12 +296,6 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst)
/***** End box *****/ /***** End box *****/
Box_BoxEnd (); Box_BoxEnd ();
/***** Write again links to pages *****/
if (Pagination.MoreThanOnePage)
Pag_WriteLinksToPagesCentered (Pag_SURVEYS,
0,
&Pagination);
/***** Free list of surveys *****/ /***** Free list of surveys *****/
Svy_FreeListSurveys (); Svy_FreeListSurveys ();
} }
@ -396,10 +389,6 @@ static void Svy_ParamsWhichGroupsToShow (void)
void Svy_SeeOneSurvey (void) void Svy_SeeOneSurvey (void)
{ {
struct Survey Svy; struct Survey Svy;
struct SurveyQuestion SvyQst;
/***** Initialize question to zero *****/
Svy_InitQst (&SvyQst);
/***** Get parameters *****/ /***** Get parameters *****/
Svy_GetParamSvyOrder (); Svy_GetParamSvyOrder ();
@ -411,15 +400,14 @@ void Svy_SeeOneSurvey (void)
Lay_ShowErrorAndExit ("Code of survey is missing."); Lay_ShowErrorAndExit ("Code of survey is missing.");
/***** Show survey *****/ /***** Show survey *****/
Svy_ShowOneSurvey (Svy.SvyCod,&SvyQst,true); Svy_ShowOneSurvey (Svy.SvyCod,true);
} }
/*****************************************************************************/ /*****************************************************************************/
/****************************** Show one survey ******************************/ /****************************** Show one survey ******************************/
/*****************************************************************************/ /*****************************************************************************/
static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst, static void Svy_ShowOneSurvey (long SvyCod,bool ShowOnlyThisSvyComplete)
bool ShowOnlyThisSvyComplete)
{ {
extern const char *Hlp_ASSESSMENT_Surveys; extern const char *Hlp_ASSESSMENT_Surveys;
extern const char *Txt_Survey; extern const char *Txt_Survey;
@ -677,7 +665,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,
{ {
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("colspan=\"5\""); HTM_TD_Begin ("colspan=\"5\"");
Svy_ListSvyQuestions (&Svy,SvyQst); Svy_ListSvyQuestions (&Svy);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
} }
@ -1537,10 +1525,6 @@ void Svy_AskRemSurvey (void)
extern const char *Txt_Do_you_really_want_to_remove_the_survey_X; extern const char *Txt_Do_you_really_want_to_remove_the_survey_X;
extern const char *Txt_Remove_survey; extern const char *Txt_Remove_survey;
struct Survey Svy; struct Survey Svy;
struct SurveyQuestion SvyQst;
/***** Initialize question to zero *****/
Svy_InitQst (&SvyQst);
/***** Get parameters *****/ /***** Get parameters *****/
Svy_GetParamSvyOrder (); Svy_GetParamSvyOrder ();
@ -1564,7 +1548,7 @@ void Svy_AskRemSurvey (void)
Svy.Title); Svy.Title);
/***** Show surveys again *****/ /***** Show surveys again *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1575,10 +1559,11 @@ void Svy_RemoveSurvey (void)
{ {
extern const char *Txt_Survey_X_removed; extern const char *Txt_Survey_X_removed;
struct Survey Svy; struct Survey Svy;
struct SurveyQuestion SvyQst;
/***** Initialize question to zero *****/ /***** Get parameters *****/
Svy_InitQst (&SvyQst); Svy_GetParamSvyOrder ();
Grp_GetParamWhichGrps ();
Gbl.Svys.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
/***** Get survey code *****/ /***** Get survey code *****/
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L) if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
@ -1623,7 +1608,7 @@ void Svy_RemoveSurvey (void)
Svy.Title); Svy.Title);
/***** Show surveys again *****/ /***** Show surveys again *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1634,10 +1619,6 @@ void Svy_AskResetSurvey (void)
{ {
extern const char *Txt_Do_you_really_want_to_reset_the_survey_X; extern const char *Txt_Do_you_really_want_to_reset_the_survey_X;
struct Survey Svy; struct Survey Svy;
struct SurveyQuestion SvyQst;
/***** Initialize question to zero *****/
Svy_InitQst (&SvyQst);
/***** Get parameters *****/ /***** Get parameters *****/
Svy_GetParamSvyOrder (); Svy_GetParamSvyOrder ();
@ -1662,7 +1643,7 @@ void Svy_AskResetSurvey (void)
Svy_PutButtonToResetSurvey (); Svy_PutButtonToResetSurvey ();
/***** Show surveys again *****/ /***** Show surveys again *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1687,10 +1668,11 @@ void Svy_ResetSurvey (void)
{ {
extern const char *Txt_Survey_X_reset; extern const char *Txt_Survey_X_reset;
struct Survey Svy; struct Survey Svy;
struct SurveyQuestion SvyQst;
/***** Initialize question to zero *****/ /***** Get parameters *****/
Svy_InitQst (&SvyQst); Svy_GetParamSvyOrder ();
Grp_GetParamWhichGrps ();
Gbl.Svys.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
/***** Get survey code *****/ /***** Get survey code *****/
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L) if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
@ -1718,7 +1700,7 @@ void Svy_ResetSurvey (void)
Svy.Title); Svy.Title);
/***** Show surveys again *****/ /***** Show surveys again *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1728,10 +1710,6 @@ void Svy_ResetSurvey (void)
void Svy_HideSurvey (void) void Svy_HideSurvey (void)
{ {
struct Survey Svy; struct Survey Svy;
struct SurveyQuestion SvyQst;
/***** Initialize question to zero *****/
Svy_InitQst (&SvyQst);
/***** Get parameters *****/ /***** Get parameters *****/
Svy_GetParamSvyOrder (); Svy_GetParamSvyOrder ();
@ -1753,7 +1731,7 @@ void Svy_HideSurvey (void)
Svy.SvyCod); Svy.SvyCod);
/***** Show surveys again *****/ /***** Show surveys again *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1763,10 +1741,6 @@ void Svy_HideSurvey (void)
void Svy_UnhideSurvey (void) void Svy_UnhideSurvey (void)
{ {
struct Survey Svy; struct Survey Svy;
struct SurveyQuestion SvyQst;
/***** Initialize question to zero *****/
Svy_InitQst (&SvyQst);
/***** Get parameters *****/ /***** Get parameters *****/
Svy_GetParamSvyOrder (); Svy_GetParamSvyOrder ();
@ -1788,7 +1762,7 @@ void Svy_UnhideSurvey (void)
Svy.SvyCod); Svy.SvyCod);
/***** Show surveys again *****/ /***** Show surveys again *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1824,13 +1798,9 @@ void Svy_RequestCreatOrEditSvy (void)
extern const char *Txt_Create_survey; extern const char *Txt_Create_survey;
extern const char *Txt_Save_changes; extern const char *Txt_Save_changes;
struct Survey Svy; struct Survey Svy;
struct SurveyQuestion SvyQst;
bool ItsANewSurvey; bool ItsANewSurvey;
char Txt[Cns_MAX_BYTES_TEXT + 1]; char Txt[Cns_MAX_BYTES_TEXT + 1];
/***** Initialize question to zero *****/
Svy_InitQst (&SvyQst);
/***** Get parameters *****/ /***** Get parameters *****/
Svy_GetParamSvyOrder (); Svy_GetParamSvyOrder ();
Grp_GetParamWhichGrps (); Grp_GetParamWhichGrps ();
@ -1979,10 +1949,10 @@ void Svy_RequestCreatOrEditSvy (void)
/***** Show questions of the survey ready to be edited *****/ /***** Show questions of the survey ready to be edited *****/
if (!ItsANewSurvey) if (!ItsANewSurvey)
Svy_ListSvyQuestions (&Svy,&SvyQst); Svy_ListSvyQuestions (&Svy);
/***** Show all surveys *****/ /***** Show all surveys *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2133,14 +2103,15 @@ void Svy_RecFormSurvey (void)
extern const char *Txt_You_must_specify_the_title_of_the_survey; extern const char *Txt_You_must_specify_the_title_of_the_survey;
struct Survey OldSvy; struct Survey OldSvy;
struct Survey NewSvy; struct Survey NewSvy;
struct SurveyQuestion SvyQst;
bool ItsANewSurvey; bool ItsANewSurvey;
bool NewSurveyIsCorrect = true; bool NewSurveyIsCorrect = true;
unsigned NumUsrsToBeNotifiedByEMail; unsigned NumUsrsToBeNotifiedByEMail;
char Txt[Cns_MAX_BYTES_TEXT + 1]; char Txt[Cns_MAX_BYTES_TEXT + 1];
/***** Initialize question to zero *****/ /***** Get parameters *****/
Svy_InitQst (&SvyQst); Svy_GetParamSvyOrder ();
Grp_GetParamWhichGrps ();
Gbl.Svys.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
/***** Get the code of the survey *****/ /***** Get the code of the survey *****/
ItsANewSurvey = ((NewSvy.SvyCod = Svy_GetParamSvyCod ()) == -1L); ItsANewSurvey = ((NewSvy.SvyCod = Svy_GetParamSvyCod ()) == -1L);
@ -2266,7 +2237,7 @@ void Svy_RecFormSurvey (void)
Svy_UpdateNumUsrsNotifiedByEMailAboutSurvey (NewSvy.SvyCod,NumUsrsToBeNotifiedByEMail); Svy_UpdateNumUsrsNotifiedByEMailAboutSurvey (NewSvy.SvyCod,NumUsrsToBeNotifiedByEMail);
/***** Show surveys again *****/ /***** Show surveys again *****/
Svy_ListAllSurveys (&SvyQst); Svy_ListAllSurveys ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2620,7 +2591,7 @@ void Svy_RequestEditQuestion (void)
Svy_ShowFormEditOneQst (SvyCod,&SvyQst,Txt); Svy_ShowFormEditOneQst (SvyCod,&SvyQst,Txt);
/***** Show current survey *****/ /***** Show current survey *****/
Svy_ShowOneSurvey (SvyCod,&SvyQst,true); Svy_ShowOneSurvey (SvyCod,true);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3124,7 +3095,7 @@ void Svy_ReceiveQst (void)
Svy_FreeTextChoiceAnswers (&SvyQst,Svy_MAX_ANSWERS_PER_QUESTION); Svy_FreeTextChoiceAnswers (&SvyQst,Svy_MAX_ANSWERS_PER_QUESTION);
/***** Show current survey *****/ /***** Show current survey *****/
Svy_ShowOneSurvey (SvyCod,&SvyQst,true); Svy_ShowOneSurvey (SvyCod,true);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3194,8 +3165,7 @@ static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod)
/************************ List the questions of a survey *********************/ /************************ List the questions of a survey *********************/
/*****************************************************************************/ /*****************************************************************************/
static void Svy_ListSvyQuestions (struct Survey *Svy, static void Svy_ListSvyQuestions (struct Survey *Svy)
struct SurveyQuestion *SvyQst)
{ {
extern const char *Hlp_ASSESSMENT_Surveys_questions; extern const char *Hlp_ASSESSMENT_Surveys_questions;
extern const char *Txt_Questions; extern const char *Txt_Questions;
@ -3209,6 +3179,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumQsts; unsigned NumQsts;
unsigned NumQst; unsigned NumQst;
struct SurveyQuestion SvyQst;
bool Editing = (Gbl.Action.Act == ActEdiOneSvy || bool Editing = (Gbl.Action.Act == ActEdiOneSvy ||
Gbl.Action.Act == ActEdiOneSvyQst || Gbl.Action.Act == ActEdiOneSvyQst ||
Gbl.Action.Act == ActRcvSvyQst); Gbl.Action.Act == ActRcvSvyQst);
@ -3257,8 +3228,11 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,
row = mysql_fetch_row (mysql_res); row = mysql_fetch_row (mysql_res);
/* Initialize question to zero */
Svy_InitQst (&SvyQst);
/* row[0] holds the code of the question */ /* row[0] holds the code of the question */
if (sscanf (row[0],"%ld",&(SvyQst->QstCod)) != 1) if (sscanf (row[0],"%ld",&(SvyQst.QstCod)) != 1)
Lay_ShowErrorAndExit ("Wrong code of question."); Lay_ShowErrorAndExit ("Wrong code of question.");
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -3270,35 +3244,35 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,
/* Write icon to remove the question */ /* Write icon to remove the question */
Frm_StartForm (ActReqRemSvyQst); Frm_StartForm (ActReqRemSvyQst);
Svy_PutParamSvyCod (Svy->SvyCod); Svy_PutParamSvyCod (Svy->SvyCod);
Svy_PutParamQstCod (SvyQst->QstCod); Svy_PutParamQstCod (SvyQst.QstCod);
Ico_PutIconRemove (); Ico_PutIconRemove ();
Frm_EndForm (); Frm_EndForm ();
/* Write icon to edit the question */ /* Write icon to edit the question */
Svy_CurrentSvyCod = Svy->SvyCod; Svy_CurrentSvyCod = Svy->SvyCod;
Svy_CurrentQstCod = SvyQst->QstCod; Svy_CurrentQstCod = SvyQst.QstCod;
Ico_PutContextualIconToEdit (ActEdiOneSvyQst,Svy_PutParamsToEditQuestion); Ico_PutContextualIconToEdit (ActEdiOneSvyQst,Svy_PutParamsToEditQuestion);
HTM_TD_End (); HTM_TD_End ();
} }
/* Write index of question inside survey (row[1]) */ /* Write index of question inside survey (row[1]) */
if (sscanf (row[1],"%u",&(SvyQst->QstInd)) != 1) if (sscanf (row[1],"%u",&(SvyQst.QstInd)) != 1)
Lay_ShowErrorAndExit ("Error: wrong question index."); Lay_ShowErrorAndExit ("Error: wrong question index.");
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
HTM_Unsigned (SvyQst->QstInd + 1); HTM_Unsigned (SvyQst.QstInd + 1);
HTM_TD_End (); HTM_TD_End ();
/* Write the question type (row[2]) */ /* Write the question type (row[2]) */
SvyQst->AnswerType = Svy_ConvertFromStrAnsTypDBToAnsTyp (row[2]); SvyQst.AnswerType = Svy_ConvertFromStrAnsTypDBToAnsTyp (row[2]);
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
HTM_Txt (Txt_SURVEY_STR_ANSWER_TYPES[SvyQst->AnswerType]); HTM_Txt (Txt_SURVEY_STR_ANSWER_TYPES[SvyQst.AnswerType]);
HTM_TD_End (); HTM_TD_End ();
/* Write the stem (row[3]) and the answers of this question */ /* Write the stem (row[3]) and the answers of this question */
HTM_TD_Begin ("class=\"DAT LT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"DAT LT COLOR%u\"",Gbl.RowEvenOdd);
Svy_WriteQstStem (row[3]); Svy_WriteQstStem (row[3]);
Svy_WriteAnswersOfAQst (Svy,SvyQst,PutFormAnswerSurvey); Svy_WriteAnswersOfAQst (Svy,&SvyQst,PutFormAnswerSurvey);
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();
@ -3593,7 +3567,7 @@ void Svy_RequestRemoveQst (void)
(long) SvyQst.QstInd + 1); (long) SvyQst.QstInd + 1);
/***** Show current survey *****/ /***** Show current survey *****/
Svy_ShowOneSurvey (SvyCod,&SvyQst,true); Svy_ShowOneSurvey (SvyCod,true);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3642,7 +3616,7 @@ void Svy_RemoveQst (void)
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed); Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
/***** Show current survey *****/ /***** Show current survey *****/
Svy_ShowOneSurvey (SvyCod,&SvyQst,true); Svy_ShowOneSurvey (SvyCod,true);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3654,10 +3628,6 @@ void Svy_ReceiveSurveyAnswers (void)
extern const char *Txt_You_already_answered_this_survey_before; extern const char *Txt_You_already_answered_this_survey_before;
extern const char *Txt_Thanks_for_answering_the_survey; extern const char *Txt_Thanks_for_answering_the_survey;
struct Survey Svy; struct Survey Svy;
struct SurveyQuestion SvyQst;
/***** Initialize question to zero *****/
Svy_InitQst (&SvyQst);
/***** Get survey code *****/ /***** Get survey code *****/
if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L) if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L)
@ -3677,7 +3647,7 @@ void Svy_ReceiveSurveyAnswers (void)
} }
/***** Show current survey *****/ /***** Show current survey *****/
Svy_ShowOneSurvey (Svy.SvyCod,&SvyQst,true); Svy_ShowOneSurvey (Svy.SvyCod,true);
} }
/*****************************************************************************/ /*****************************************************************************/