From f50dc57cb61f0deb81fa88dfcf8f45a7311f2f64 Mon Sep 17 00:00:00 2001 From: acanas Date: Sat, 25 Apr 2020 01:36:53 +0200 Subject: [PATCH] Version19.194.1 --- sql/swad.sql | 2 + swad_action.c | 19 +- swad_action.h | 165 +++++------ swad_changelog.h | 11 +- swad_database.c | 20 +- swad_exam.c | 665 +++++++++++++++++++++++++++++++++++---------- swad_exam.h | 26 +- swad_exam_event.c | 22 +- swad_exam_result.c | 32 ++- swad_forum.c | 2 +- swad_layout.c | 18 ++ swad_layout.h | 2 + swad_link.c | 2 +- swad_test_exam.c | 2 +- swad_text.c | 210 +++++++++----- swad_timeline.c | 2 +- swad_timetable.c | 2 +- 17 files changed, 861 insertions(+), 341 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index 0650d516..5f53e6d3 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -539,6 +539,8 @@ CREATE TABLE IF NOT EXISTS exa_sets ( SetCod INT NOT NULL AUTO_INCREMENT, ExaCod INT NOT NULL, SetInd INT NOT NULL DEFAULT 0, + NumQstsToExam INT NOT NULL DEFAULT 0, + Title VARCHAR(2047) NOT NULL, UNIQUE INDEX(SetCod), INDEX(ExaCod,SetInd)); -- diff --git a/swad_action.c b/swad_action.c index b1f5ab8b..02e9a582 100644 --- a/swad_action.c +++ b/swad_action.c @@ -717,11 +717,15 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActRemExa ] = {1882,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RemoveExam ,NULL}, [ActHidExa ] = {1883,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_HideExam ,NULL}, [ActShoExa ] = {1884,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_UnhideExam ,NULL}, - [ActAddOneExaSet ] = {1892,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Exa_RequestNewSet ,NULL}, - [ActReqRemExaSet ] = {1893,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RequestRemoveSet ,NULL}, - [ActRemExaSet ] = {1894,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_RemoveSet ,NULL}, - [ActUp_ExaSet ] = {1895,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_MoveUpSet ,NULL}, - [ActDwnExaSet ] = {1896,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_MoveDownSet ,NULL}, + + [ActFrmNewExaSet ] = {1892,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,ExaSet_RequestCreatOrEditSet ,NULL}, + [ActEdiOneExaSet ] = {1897,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_RequestCreatOrEditSet ,NULL}, + [ActNewExaSet ] = {1898,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_RecFormSet ,NULL}, + [ActChgExaSet ] = {1899,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_RecFormSet ,NULL}, + [ActReqRemExaSet ] = {1893,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_RequestRemoveSet ,NULL}, + [ActRemExaSet ] = {1894,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_RemoveSet ,NULL}, + [ActUp_ExaSet ] = {1895,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_MoveUpSet ,NULL}, + [ActDwnExaSet ] = {1896,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSet_MoveDownSet ,NULL}, [ActAddOneExaQst ] = {1885,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,Exa_RequestNewQuestion ,NULL}, [ActLstTstQstForExa ] = {1886,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_ListQuestionsToSelect ,NULL}, @@ -3700,11 +3704,14 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActRemExaQst, // #1889 ActUp_ExaQst, // #1890 ActDwnExaQst, // #1891 - ActAddOneExaSet, // #1892 + ActFrmNewExaSet, // #1892 ActReqRemExaSet, // #1893 ActRemExaSet, // #1894 ActUp_ExaSet, // #1895 ActDwnExaSet, // #1896 + ActEdiOneExaSet, // #1897 + ActNewExaSet, // #1898 + ActChgExaSet, // #1899 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 257cfce7..47e9e0c4 100644 --- a/swad_action.h +++ b/swad_action.h @@ -64,7 +64,7 @@ typedef enum typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_MAX_ACTION_COD 1896 +#define Act_MAX_ACTION_COD 1899 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13 @@ -683,95 +683,98 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActRemExa (ActChgCrsTT1stDay + 156) #define ActHidExa (ActChgCrsTT1stDay + 157) #define ActShoExa (ActChgCrsTT1stDay + 158) -#define ActAddOneExaSet (ActChgCrsTT1stDay + 159) -#define ActReqRemExaSet (ActChgCrsTT1stDay + 160) -#define ActRemExaSet (ActChgCrsTT1stDay + 161) -#define ActUp_ExaSet (ActChgCrsTT1stDay + 162) -#define ActDwnExaSet (ActChgCrsTT1stDay + 163) +#define ActFrmNewExaSet (ActChgCrsTT1stDay + 159) +#define ActEdiOneExaSet (ActChgCrsTT1stDay + 160) +#define ActNewExaSet (ActChgCrsTT1stDay + 161) +#define ActChgExaSet (ActChgCrsTT1stDay + 162) +#define ActReqRemExaSet (ActChgCrsTT1stDay + 163) +#define ActRemExaSet (ActChgCrsTT1stDay + 164) +#define ActUp_ExaSet (ActChgCrsTT1stDay + 165) +#define ActDwnExaSet (ActChgCrsTT1stDay + 166) -#define ActAddOneExaQst (ActChgCrsTT1stDay + 164) -#define ActLstTstQstForExa (ActChgCrsTT1stDay + 165) -#define ActAddQstToExa (ActChgCrsTT1stDay + 166) -#define ActReqRemExaQst (ActChgCrsTT1stDay + 167) -#define ActRemExaQst (ActChgCrsTT1stDay + 168) -#define ActUp_ExaQst (ActChgCrsTT1stDay + 169) -#define ActDwnExaQst (ActChgCrsTT1stDay + 170) +#define ActAddOneExaQst (ActChgCrsTT1stDay + 167) +#define ActLstTstQstForExa (ActChgCrsTT1stDay + 168) +#define ActAddQstToExa (ActChgCrsTT1stDay + 169) +#define ActReqRemExaQst (ActChgCrsTT1stDay + 170) +#define ActRemExaQst (ActChgCrsTT1stDay + 171) +#define ActUp_ExaQst (ActChgCrsTT1stDay + 172) +#define ActDwnExaQst (ActChgCrsTT1stDay + 173) -#define ActSeeGam (ActChgCrsTT1stDay + 171) -#define ActReqRemMch (ActChgCrsTT1stDay + 172) -#define ActRemMch (ActChgCrsTT1stDay + 173) -#define ActReqNewMch (ActChgCrsTT1stDay + 174) -#define ActNewMch (ActChgCrsTT1stDay + 175) -#define ActResMch (ActChgCrsTT1stDay + 176) -#define ActBckMch (ActChgCrsTT1stDay + 177) -#define ActPlyPauMch (ActChgCrsTT1stDay + 178) -#define ActFwdMch (ActChgCrsTT1stDay + 179) -#define ActChgNumColMch (ActChgCrsTT1stDay + 180) -#define ActChgVisResMchQst (ActChgCrsTT1stDay + 181) -#define ActMchCntDwn (ActChgCrsTT1stDay + 182) -#define ActRefMchTch (ActChgCrsTT1stDay + 183) +#define ActSeeGam (ActChgCrsTT1stDay + 174) +#define ActReqRemMch (ActChgCrsTT1stDay + 175) +#define ActRemMch (ActChgCrsTT1stDay + 176) +#define ActReqNewMch (ActChgCrsTT1stDay + 177) +#define ActNewMch (ActChgCrsTT1stDay + 178) +#define ActResMch (ActChgCrsTT1stDay + 179) +#define ActBckMch (ActChgCrsTT1stDay + 180) +#define ActPlyPauMch (ActChgCrsTT1stDay + 181) +#define ActFwdMch (ActChgCrsTT1stDay + 182) +#define ActChgNumColMch (ActChgCrsTT1stDay + 183) +#define ActChgVisResMchQst (ActChgCrsTT1stDay + 184) +#define ActMchCntDwn (ActChgCrsTT1stDay + 185) +#define ActRefMchTch (ActChgCrsTT1stDay + 186) -#define ActJoiMch (ActChgCrsTT1stDay + 184) -#define ActSeeMchAnsQstStd (ActChgCrsTT1stDay + 185) -#define ActRemMchAnsQstStd (ActChgCrsTT1stDay + 186) -#define ActAnsMchQstStd (ActChgCrsTT1stDay + 187) -#define ActRefMchStd (ActChgCrsTT1stDay + 188) +#define ActJoiMch (ActChgCrsTT1stDay + 187) +#define ActSeeMchAnsQstStd (ActChgCrsTT1stDay + 188) +#define ActRemMchAnsQstStd (ActChgCrsTT1stDay + 189) +#define ActAnsMchQstStd (ActChgCrsTT1stDay + 190) +#define ActRefMchStd (ActChgCrsTT1stDay + 191) -#define ActSeeMyMchResCrs (ActChgCrsTT1stDay + 189) -#define ActSeeMyMchResGam (ActChgCrsTT1stDay + 190) -#define ActSeeMyMchResMch (ActChgCrsTT1stDay + 191) -#define ActSeeOneMchResMe (ActChgCrsTT1stDay + 192) +#define ActSeeMyMchResCrs (ActChgCrsTT1stDay + 192) +#define ActSeeMyMchResGam (ActChgCrsTT1stDay + 193) +#define ActSeeMyMchResMch (ActChgCrsTT1stDay + 194) +#define ActSeeOneMchResMe (ActChgCrsTT1stDay + 195) -#define ActReqSeeAllMchRes (ActChgCrsTT1stDay + 193) -#define ActSeeAllMchResCrs (ActChgCrsTT1stDay + 194) -#define ActSeeAllMchResGam (ActChgCrsTT1stDay + 195) -#define ActSeeAllMchResMch (ActChgCrsTT1stDay + 196) -#define ActSeeOneMchResOth (ActChgCrsTT1stDay + 197) +#define ActReqSeeAllMchRes (ActChgCrsTT1stDay + 196) +#define ActSeeAllMchResCrs (ActChgCrsTT1stDay + 197) +#define ActSeeAllMchResGam (ActChgCrsTT1stDay + 198) +#define ActSeeAllMchResMch (ActChgCrsTT1stDay + 199) +#define ActSeeOneMchResOth (ActChgCrsTT1stDay + 200) -#define ActChgVisResMchUsr (ActChgCrsTT1stDay + 198) +#define ActChgVisResMchUsr (ActChgCrsTT1stDay + 201) -#define ActFrmNewGam (ActChgCrsTT1stDay + 199) -#define ActEdiOneGam (ActChgCrsTT1stDay + 200) -#define ActNewGam (ActChgCrsTT1stDay + 201) -#define ActChgGam (ActChgCrsTT1stDay + 202) -#define ActReqRemGam (ActChgCrsTT1stDay + 203) -#define ActRemGam (ActChgCrsTT1stDay + 204) -#define ActHidGam (ActChgCrsTT1stDay + 205) -#define ActShoGam (ActChgCrsTT1stDay + 206) -#define ActAddOneGamQst (ActChgCrsTT1stDay + 207) -#define ActGamLstTstQst (ActChgCrsTT1stDay + 208) -#define ActAddTstQstToGam (ActChgCrsTT1stDay + 209) -#define ActReqRemGamQst (ActChgCrsTT1stDay + 210) -#define ActRemGamQst (ActChgCrsTT1stDay + 211) -#define ActUp_GamQst (ActChgCrsTT1stDay + 212) -#define ActDwnGamQst (ActChgCrsTT1stDay + 213) +#define ActFrmNewGam (ActChgCrsTT1stDay + 202) +#define ActEdiOneGam (ActChgCrsTT1stDay + 203) +#define ActNewGam (ActChgCrsTT1stDay + 204) +#define ActChgGam (ActChgCrsTT1stDay + 205) +#define ActReqRemGam (ActChgCrsTT1stDay + 206) +#define ActRemGam (ActChgCrsTT1stDay + 207) +#define ActHidGam (ActChgCrsTT1stDay + 208) +#define ActShoGam (ActChgCrsTT1stDay + 209) +#define ActAddOneGamQst (ActChgCrsTT1stDay + 210) +#define ActGamLstTstQst (ActChgCrsTT1stDay + 211) +#define ActAddTstQstToGam (ActChgCrsTT1stDay + 212) +#define ActReqRemGamQst (ActChgCrsTT1stDay + 213) +#define ActRemGamQst (ActChgCrsTT1stDay + 214) +#define ActUp_GamQst (ActChgCrsTT1stDay + 215) +#define ActDwnGamQst (ActChgCrsTT1stDay + 216) -#define ActSeeSvy (ActChgCrsTT1stDay + 214) -#define ActAnsSvy (ActChgCrsTT1stDay + 215) -#define ActFrmNewSvy (ActChgCrsTT1stDay + 216) -#define ActEdiOneSvy (ActChgCrsTT1stDay + 217) -#define ActNewSvy (ActChgCrsTT1stDay + 218) -#define ActChgSvy (ActChgCrsTT1stDay + 219) -#define ActReqRemSvy (ActChgCrsTT1stDay + 220) -#define ActRemSvy (ActChgCrsTT1stDay + 221) -#define ActReqRstSvy (ActChgCrsTT1stDay + 222) -#define ActRstSvy (ActChgCrsTT1stDay + 223) -#define ActHidSvy (ActChgCrsTT1stDay + 224) -#define ActShoSvy (ActChgCrsTT1stDay + 225) -#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 226) -#define ActRcvSvyQst (ActChgCrsTT1stDay + 227) -#define ActReqRemSvyQst (ActChgCrsTT1stDay + 228) -#define ActRemSvyQst (ActChgCrsTT1stDay + 229) +#define ActSeeSvy (ActChgCrsTT1stDay + 217) +#define ActAnsSvy (ActChgCrsTT1stDay + 218) +#define ActFrmNewSvy (ActChgCrsTT1stDay + 219) +#define ActEdiOneSvy (ActChgCrsTT1stDay + 220) +#define ActNewSvy (ActChgCrsTT1stDay + 221) +#define ActChgSvy (ActChgCrsTT1stDay + 222) +#define ActReqRemSvy (ActChgCrsTT1stDay + 223) +#define ActRemSvy (ActChgCrsTT1stDay + 224) +#define ActReqRstSvy (ActChgCrsTT1stDay + 225) +#define ActRstSvy (ActChgCrsTT1stDay + 226) +#define ActHidSvy (ActChgCrsTT1stDay + 227) +#define ActShoSvy (ActChgCrsTT1stDay + 228) +#define ActEdiOneSvyQst (ActChgCrsTT1stDay + 229) +#define ActRcvSvyQst (ActChgCrsTT1stDay + 230) +#define ActReqRemSvyQst (ActChgCrsTT1stDay + 231) +#define ActRemSvyQst (ActChgCrsTT1stDay + 232) -#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 230) -#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 231) -#define ActEdiExaAnn (ActChgCrsTT1stDay + 232) -#define ActRcvExaAnn (ActChgCrsTT1stDay + 233) -#define ActPrnExaAnn (ActChgCrsTT1stDay + 234) -#define ActReqRemExaAnn (ActChgCrsTT1stDay + 235) -#define ActRemExaAnn (ActChgCrsTT1stDay + 236) -#define ActHidExaAnn (ActChgCrsTT1stDay + 237) -#define ActShoExaAnn (ActChgCrsTT1stDay + 238) +#define ActSeeOneExaAnn (ActChgCrsTT1stDay + 233) +#define ActSeeDatExaAnn (ActChgCrsTT1stDay + 234) +#define ActEdiExaAnn (ActChgCrsTT1stDay + 235) +#define ActRcvExaAnn (ActChgCrsTT1stDay + 236) +#define ActPrnExaAnn (ActChgCrsTT1stDay + 237) +#define ActReqRemExaAnn (ActChgCrsTT1stDay + 238) +#define ActRemExaAnn (ActChgCrsTT1stDay + 239) +#define ActHidExaAnn (ActChgCrsTT1stDay + 240) +#define ActShoExaAnn (ActChgCrsTT1stDay + 241) /*****************************************************************************/ /******************************** Files tab **********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index 7e31c154..2b24c0a8 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -544,11 +544,18 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.194 (2020-04-24)" +#define Log_PLATFORM_VERSION "SWAD 19.195 (2020-04-25)" #define CSS_FILE "swad19.193.1.css" #define JS_FILE "swad19.193.1.js" /* - Version 19.194: Apr 24, 2020 New database table for question sets in exams. (298257 lines) + + Version 19.195: Apr 25, 2020 Changes in sets of questions. (298699 lines) + 2 changes necessary in database: +ALTER TABLE exa_sets ADD COLUMN NumQstsToExam INT NOT NULL DEFAULT 0 AFTER SetInd; +ALTER TABLE exa_sets ADD COLUMN Title VARCHAR(2047) NOT NULL AFTER NumQstsToExam; + + Version 19.194.1: Apr 24, 2020 Translate messages related to sets of questions. (? lines) + Version 19.194: Apr 24, 2020 New database table for set of questions in exams. (298257 lines) 1 change necessary in database: CREATE TABLE IF NOT EXISTS exa_sets (SetCod INT NOT NULL AUTO_INCREMENT,ExaCod INT NOT NULL,SetInd INT NOT NULL DEFAULT 0,UNIQUE INDEX(SetCod),INDEX(ExaCod,SetInd)); diff --git a/swad_database.c b/swad_database.c index e425b03e..82a940c9 100644 --- a/swad_database.c +++ b/swad_database.c @@ -1185,19 +1185,23 @@ mysql> DESCRIBE exa_results; /***** Table exa_sets *****/ /* mysql> DESCRIBE exa_sets; -+--------+---------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+--------+---------+------+-----+---------+-------+ -| ExaCod | int(11) | NO | MUL | NULL | | -| QstCod | int(11) | NO | MUL | NULL | | -| QstInd | int(11) | NO | | 0 | | -+--------+---------+------+-----+---------+-------+ -3 rows in set (0.01 sec) ++---------------+---------------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++---------------+---------------+------+-----+---------+----------------+ +| SetCod | int(11) | NO | PRI | NULL | auto_increment | +| ExaCod | int(11) | NO | MUL | NULL | | +| SetInd | int(11) | NO | | 0 | | +| NumQstsToExam | int(11) | NO | | 0 | | +| Title | varchar(2047) | NO | | NULL | | ++---------------+---------------+------+-----+---------+----------------+ +5 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS exa_sets (" "SetCod INT NOT NULL AUTO_INCREMENT," "ExaCod INT NOT NULL," "SetInd INT NOT NULL DEFAULT 0," + "NumQstsToExam INT NOT NULL DEFAULT 0," + "Title VARCHAR(2047) NOT NULL," // ExaSet_MAX_BYTES_TITLE "UNIQUE INDEX(SetCod)," "INDEX(ExaCod,SetInd))"); diff --git a/swad_exam.c b/swad_exam.c index cefeaf97..6fd2f67c 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -139,8 +139,16 @@ static void Exa_GetExamTxtFromDB (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]); static void Exa_RemoveExamFromAllTables (long ExaCod); +static bool ExaSet_CheckIfSimilarSetExists (const struct ExaSet_Set *Set); static bool Exa_CheckIfSimilarExamExists (const struct Exa_Exam *Exam); +static void ExaSet_PutFormsEditionSet (struct Exa_Exams *Exams, + struct Exa_Exam *Exam, + struct ExaSet_Set *Set, + bool ItsANewSet); +static void ExaSet_ReceiveSetFieldsFromForm (struct ExaSet_Set *Set); +static bool ExaSet_CheckSetFieldsReceivedFromForm (const struct ExaSet_Set *Set); + static void Exa_PutFormsEditionExam (struct Exa_Exams *Exams, struct Exa_Exam *Exam, char Txt[Cns_MAX_BYTES_TEXT + 1], @@ -149,6 +157,9 @@ static void Exa_ReceiveExamFieldsFromForm (struct Exa_Exam *Exam, char Txt[Cns_MAX_BYTES_TEXT + 1]); static bool Exa_CheckExamFieldsReceivedFromForm (const struct Exa_Exam *Exam); +static void ExaSet_CreateSet (struct ExaSet_Set *Set); +static void ExaSet_UpdateSet (struct ExaSet_Set *Set); + static void Exa_CreateExam (struct Exa_Exam *Exam,const char *Txt); static void Exa_UpdateExam (struct Exa_Exam *Exam,const char *Txt); @@ -158,12 +169,11 @@ static unsigned Exa_GetMaxSetIndexInExam (long ExaCod); static unsigned Exa_GetMaxQuestionIndexInExam (long ExaCod); static void Exa_ListExamSets (struct Exa_Exams *Exams,struct Exa_Exam *Exam); static void Exa_ListExamQuestions (struct Exa_Exams *Exams,struct Exa_Exam *Exam); -static void Exa_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, - long ExaCod,unsigned NumSets, - MYSQL_RES *mysql_res, - bool ICanEditSets); -static void Exa_SetConstructor (struct Exa_Set *Set); -static void Exa_SetDestructor (struct Exa_Set *Set); +static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, + long ExaCod,unsigned NumSets, + MYSQL_RES *mysql_res, + bool ICanEditSets); +static void ExaSet_ResetSet (struct ExaSet_Set *Set); static void Exa_PutParamSetCod (void *SetCod); static void Exa_ListOneOrMoreQuestionsForEdition (struct Exa_Exams *Exams, long ExaCod,unsigned NumQsts, @@ -238,7 +248,7 @@ void Exa_SeeAllExams (void) Exa_ResetExams (&Exams); /***** Get parameters *****/ - Exa_GetParams (&Exams); // Return value ignored + Exa_GetParams (&Exams); /***** Show all exams *****/ Exa_ListAllExams (&Exams); @@ -460,8 +470,12 @@ void Exa_SeeOneExam (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam *****/ Exa_GetDataOfExamByCod (&Exam); /***** Show exam *****/ @@ -750,7 +764,7 @@ static void Exa_PutFormsToRemEditOneExam (struct Exa_Exams *Exams, } /*****************************************************************************/ -/************** Put parameter to move/remove one question set ****************/ +/************** Put parameter to move/remove one set of questions ****************/ /*****************************************************************************/ static void Exa_PutParamsOneSet (void *Exams) @@ -813,18 +827,28 @@ long Exa_GetParamExamCod (void) return Par_GetParToLong ("ExaCod"); } +/*****************************************************************************/ +/********************** Get parameter with code of set ***********************/ +/*****************************************************************************/ + +long ExaSet_GetParamSetCod (void) + { + /***** Get code of set *****/ + return Par_GetParToLong ("SetCod"); + } + /*****************************************************************************/ /******************* Get parameters used to edit an exam **********************/ /*****************************************************************************/ -long Exa_GetParams (struct Exa_Exams *Exams) +void Exa_GetParams (struct Exa_Exams *Exams) { /***** Get other parameters *****/ Exams->SelectedOrder = Exa_GetParamOrder (); Exams->CurrentPage = Pag_GetParamPagNum (Pag_EXAMS); /***** Get exam code *****/ - return Exa_GetParamExamCod (); + Exams->ExaCod = Exa_GetParamExamCod (); } /*****************************************************************************/ @@ -1001,6 +1025,39 @@ void Exa_GetListSelectedExaCods (struct Exa_Exams *Exams) } } +/*****************************************************************************/ +/*********************** Get set data using its code *************************/ +/*****************************************************************************/ + +void ExaSet_GetDataOfSetByCod (struct ExaSet_Set *Set) + { + MYSQL_RES *mysql_res; + MYSQL_ROW row; + unsigned long NumRows; + + /***** Get data of set from database *****/ + NumRows = DB_QuerySELECT (&mysql_res,"can not get set data", + "SELECT SetInd" // row[0] + " FROM exa_sets" + " WHERE SetCod=%ld" + " AND ExaCod=%ld", // Extra check + Set->SetCod,Set->ExaCod); + if (NumRows) // Set found... + { + /* Get row */ + row = mysql_fetch_row (mysql_res); + + /* Get index of the set (row[0]) */ + Set->SetInd = Str_ConvertStrToUnsigned (row[0]); + } + else + /* Initialize to empty set */ + ExaSet_ResetSet (Set); + + /* Free structure that stores the query result */ + DB_FreeMySQLResult (&mysql_res); + } + /*****************************************************************************/ /********************** Get exam data using its code *************************/ /*****************************************************************************/ @@ -1161,6 +1218,10 @@ void Exa_AskRemExam (void) struct Exa_Exams Exams; struct Exa_Exam Exam; + /***** Check if I can edit exams *****/ + if (!Exa_CheckIfICanEditExams ()) + Lay_NoPermissionExit (); + /***** Reset exams context *****/ Exa_ResetExams (&Exams); @@ -1168,13 +1229,13 @@ void Exa_AskRemExam (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; /***** Get data of the exam from database *****/ Exa_GetDataOfExamByCod (&Exam); - if (!Exa_CheckIfICanEditExams ()) - Lay_NoPermissionExit (); /***** Show question and button to remove exam *****/ Exams.ExaCod = Exam.ExaCod; @@ -1198,6 +1259,10 @@ void Exa_RemoveExam (void) struct Exa_Exams Exams; struct Exa_Exam Exam; + /***** Check if I can edit exams *****/ + if (!Exa_CheckIfICanEditExams ()) + Lay_NoPermissionExit (); + /***** Reset exams context *****/ Exa_ResetExams (&Exams); @@ -1210,8 +1275,6 @@ void Exa_RemoveExam (void) /***** Get data of the exam from database *****/ Exa_GetDataOfExamByCod (&Exam); - if (!Exa_CheckIfICanEditExams ()) - Lay_NoPermissionExit (); /***** Remove exam from all tables *****/ Exa_RemoveExamFromAllTables (Exam.ExaCod); @@ -1277,6 +1340,10 @@ void Exa_HideExam (void) struct Exa_Exams Exams; struct Exa_Exam Exam; + /***** Check if I can edit exams *****/ + if (!Exa_CheckIfICanEditExams ()) + Lay_NoPermissionExit (); + /***** Reset exams context *****/ Exa_ResetExams (&Exams); @@ -1284,13 +1351,13 @@ void Exa_HideExam (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; /***** Get data of the exam from database *****/ Exa_GetDataOfExamByCod (&Exam); - if (!Exa_CheckIfICanEditExams ()) - Lay_NoPermissionExit (); /***** Hide exam *****/ DB_QueryUPDATE ("can not hide exam", @@ -1310,6 +1377,10 @@ void Exa_UnhideExam (void) struct Exa_Exams Exams; struct Exa_Exam Exam; + /***** Check if I can edit exams *****/ + if (!Exa_CheckIfICanEditExams ()) + Lay_NoPermissionExit (); + /***** Reset exams context *****/ Exa_ResetExams (&Exams); @@ -1317,13 +1388,13 @@ void Exa_UnhideExam (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; /***** Get data of the exam from database *****/ Exa_GetDataOfExamByCod (&Exam); - if (!Exa_CheckIfICanEditExams ()) - Lay_NoPermissionExit (); /***** Show exam *****/ DB_QueryUPDATE ("can not show exam", @@ -1334,6 +1405,24 @@ void Exa_UnhideExam (void) Exa_ListAllExams (&Exams); } +/*****************************************************************************/ +/************** Check if the title of a set of questions exists **************/ +/*****************************************************************************/ + +static bool ExaSet_CheckIfSimilarSetExists (const struct ExaSet_Set *Set) + { + /***** Get number of set of questions with a field value from database *****/ + return (DB_QueryCOUNT ("can not get similar sets of questions", + "SELECT COUNT(*) FROM exa_sets,exa_exams" + " WHERE exa_sets.ExaCod=%ld AND exa_sets.Title='%s'" + " AND exa_sets.SetCod<>%ld" + " AND exa_sets.ExaCod=exa_exams.ExaCod" + " AND exa_exams.CrsCod=%ld", // Extra check + Set->ExaCod,Set->Title, + Set->SetCod, + Gbl.Hierarchy.Crs.CrsCod) != 0); + } + /*****************************************************************************/ /******************* Check if the title of an exam exists *******************/ /*****************************************************************************/ @@ -1360,18 +1449,22 @@ void Exa_RequestCreatOrEditExam (void) bool ItsANewExam; char Txt[Cns_MAX_BYTES_TEXT + 1]; + /***** Check if I can edit exams *****/ + if (!Exa_CheckIfICanEditExams ()) + Lay_NoPermissionExit (); + /***** Reset exams context *****/ Exa_ResetExams (&Exams); /***** Reset exam *****/ Exa_ResetExam (&Exam); - /***** Check if I can edit exams *****/ - if (!Exa_CheckIfICanEditExams ()) - Lay_NoPermissionExit (); - /***** Get parameters *****/ - ItsANewExam = ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + ItsANewExam = (Exam.ExaCod <= 0); /***** Get exam data *****/ if (ItsANewExam) @@ -1408,6 +1501,183 @@ void Exa_RequestCreatOrEditExam (void) /********************* Put a form to create/edit an exam **********************/ /*****************************************************************************/ +static void ExaSet_PutFormsEditionSet (struct Exa_Exams *Exams, + struct Exa_Exam *Exam, + struct ExaSet_Set *Set, + bool ItsANewSet) + { + // extern const char *Hlp_ASSESSMENT_Exams_new_set; + // extern const char *Hlp_ASSESSMENT_Exams_edit_set; + extern const char *The_ClassFormInBox[The_NUM_THEMES]; + extern const char *Txt_New_set; + extern const char *Txt_Edit_set; + extern const char *Txt_Title; + extern const char *Txt_Number_of_questions_in_this_set_that_will_appear_in_the_exam; + extern const char *Txt_Create_set; + extern const char *Txt_Save_changes; + + /***** Begin form *****/ + Exams->ExaCod = Exam->ExaCod; + Frm_StartForm (ItsANewSet ? ActNewExaSet : + ActChgExaSet); + Exa_PutParams (Exams); + + /***** Begin box and table *****/ + if (ItsANewSet) + Box_BoxTableBegin (NULL,Txt_New_set, + NULL,NULL, + NULL,Box_NOT_CLOSABLE,2); + else + Box_BoxTableBegin (NULL, + Exam->Title[0] ? Exam->Title : + Txt_Edit_set, + NULL,NULL, + NULL,Box_NOT_CLOSABLE,2); + + /***** Set title *****/ + HTM_TR_Begin (NULL); + + /* Label */ + Frm_LabelColumn ("RT","Title",Txt_Title); + + /* Data */ + HTM_TD_Begin ("class=\"LT\""); + HTM_INPUT_TEXT ("Title",ExaSet_MAX_CHARS_TITLE,Set->Title,false, + "id=\"Title\" required=\"required\"" + " class=\"TITLE_DESCRIPTION_WIDTH\""); + HTM_TD_End (); + + HTM_TR_End (); + + /***** Number of questions in this set that will appear in the exam *****/ + HTM_TR_Begin (NULL); + + HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]); + HTM_TxtF ("%s:",Txt_Number_of_questions_in_this_set_that_will_appear_in_the_exam); + HTM_TD_End (); + + HTM_TD_Begin ("class=\"LM\""); + HTM_INPUT_LONG ("NumQstsToExam",0,UINT_MAX,Set->NumQstsToExam,false, + "required=\"required\""); + HTM_TD_End (); + + HTM_TR_End (); + + /***** End table, send button and end box *****/ + if (ItsANewSet) + Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_set); + else + Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Save_changes); + + /***** End form *****/ + Frm_EndForm (); + } + +/*****************************************************************************/ +/**************** Receive form to create a new set of questions **************/ +/*****************************************************************************/ + +void ExaSet_RecFormSet (void) + { + struct Exa_Exams Exams; + struct Exa_Exam Exam; + struct ExaSet_Set Set; + bool ItsANewSet; + + /***** Check if I can edit exams *****/ + if (!Exa_CheckIfICanEditExams ()) + Lay_NoPermissionExit (); + + /***** Reset exams context *****/ + Exa_ResetExams (&Exams); + + /***** Reset exam and set *****/ + Exa_ResetExam (&Exam); + ExaSet_ResetSet (&Set); + + /***** Get parameters *****/ + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Set.ExaCod = Exam.ExaCod = Exams.ExaCod; + Set.SetCod = ExaSet_GetParamSetCod (); + ItsANewSet = (Exam.ExaCod <= 0); + + /***** If I can edit exams ==> receive set from form *****/ + ExaSet_ReceiveSetFieldsFromForm (&Set); + if (ExaSet_CheckSetFieldsReceivedFromForm (&Set)) + { + /***** Create a new exam or update an existing one *****/ + if (ItsANewSet) + ExaSet_CreateSet (&Set); // Add new set to database + else + ExaSet_UpdateSet (&Set); // Update set data in database + + /***** Put forms to edit the set created or updated *****/ + ExaSet_PutFormsEditionSet (&Exams,&Exam,&Set, + false); // No new set + + /***** Show questions of the exam ready to be edited ******/ + Exa_ListExamQuestions (&Exams,&Exam); + } + else + { + /***** Put forms to create/edit the set *****/ + ExaSet_PutFormsEditionSet (&Exams,&Exam,&Set,ItsANewSet); + + /***** Show exams or questions *****/ + if (ItsANewSet) + /* Show exams again */ + Exa_ListAllExams (&Exams); + else + /* Show questions of the exam ready to be edited */ + Exa_ListExamQuestions (&Exams,&Exam); + } + } + +static void ExaSet_ReceiveSetFieldsFromForm (struct ExaSet_Set *Set) + { + /***** Get set title *****/ + Par_GetParToText ("Title",Set->Title,ExaSet_MAX_BYTES_TITLE); + + /***** Get number of questions in set to appear in exam *****/ + Set->NumQstsToExam = (unsigned) Par_GetParToUnsignedLong ("NumQstsToExam", + 0, + UINT_MAX, + 0); + } + +static bool ExaSet_CheckSetFieldsReceivedFromForm (const struct ExaSet_Set *Set) + { + extern const char *Txt_Already_existed_a_set_of_questions_in_this_exam_with_the_title_X; + extern const char *Txt_You_must_specify_the_title_of_the_set_of_questions; + bool NewSetIsCorrect; + + /***** Check if title is correct *****/ + NewSetIsCorrect = true; + if (Set->Title[0]) // If there's an set title + { + /* If title of set was in database... */ + if (ExaSet_CheckIfSimilarSetExists (Set)) + { + NewSetIsCorrect = false; + Ale_ShowAlert (Ale_WARNING,Txt_Already_existed_a_set_of_questions_in_this_exam_with_the_title_X, + Set->Title); + } + } + else // If there is not a set title + { + NewSetIsCorrect = false; + Ale_ShowAlert (Ale_WARNING,Txt_You_must_specify_the_title_of_the_set_of_questions); + } + + return NewSetIsCorrect; + } + +/*****************************************************************************/ +/********************* Put a form to create/edit an exam **********************/ +/*****************************************************************************/ + static void Exa_PutFormsEditionExam (struct Exa_Exams *Exams, struct Exa_Exam *Exam, char Txt[Cns_MAX_BYTES_TEXT + 1], @@ -1522,54 +1792,53 @@ void Exa_RecFormExam (void) bool ItsANewExam; char Txt[Cns_MAX_BYTES_TEXT + 1]; + /***** Check if I can edit exams *****/ + if (!Exa_CheckIfICanEditExams ()) + Lay_NoPermissionExit (); + /***** Reset exams context *****/ Exa_ResetExams (&Exams); /***** Reset exam *****/ Exa_ResetExam (&Exam); - /***** Check if I can edit exams *****/ - if (!Exa_CheckIfICanEditExams ()) - Lay_NoPermissionExit (); - /***** Get parameters *****/ - ItsANewExam = ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + ItsANewExam = (Exam.ExaCod <= 0); /***** If I can edit exams ==> receive exam from form *****/ - if (Exa_CheckIfICanEditExams ()) + Exa_ReceiveExamFieldsFromForm (&Exam,Txt); + if (Exa_CheckExamFieldsReceivedFromForm (&Exam)) { - Exa_ReceiveExamFieldsFromForm (&Exam,Txt); - if (Exa_CheckExamFieldsReceivedFromForm (&Exam)) - { - /***** Create a new exam or update an existing one *****/ - if (ItsANewExam) - Exa_CreateExam (&Exam,Txt); // Add new exam to database - else - Exa_UpdateExam (&Exam,Txt); // Update exam data in database - - /***** Put forms to edit the exam created or updated *****/ - Exa_PutFormsEditionExam (&Exams,&Exam,Txt, - false); // No new exam - - /***** Show questions of the exam ready to be edited ******/ - Exa_ListExamQuestions (&Exams,&Exam); - } + /***** Create a new exam or update an existing one *****/ + if (ItsANewExam) + Exa_CreateExam (&Exam,Txt); // Add new exam to database else - { - /***** Put forms to create/edit the exam *****/ - Exa_PutFormsEditionExam (&Exams,&Exam,Txt,ItsANewExam); + Exa_UpdateExam (&Exam,Txt); // Update exam data in database - /***** Show exams or questions *****/ - if (ItsANewExam) - /* Show exams again */ - Exa_ListAllExams (&Exams); - else - /* Show questions of the exam ready to be edited */ - Exa_ListExamQuestions (&Exams,&Exam); - } + /***** Put forms to edit the exam created or updated *****/ + Exa_PutFormsEditionExam (&Exams,&Exam,Txt, + false); // No new exam + + /***** Show questions of the exam ready to be edited ******/ + Exa_ListExamQuestions (&Exams,&Exam); } else - Lay_NoPermissionExit (); + { + /***** Put forms to create/edit the exam *****/ + Exa_PutFormsEditionExam (&Exams,&Exam,Txt,ItsANewExam); + + /***** Show exams or questions *****/ + if (ItsANewExam) + /* Show exams again */ + Exa_ListAllExams (&Exams); + else + /* Show questions of the exam ready to be edited */ + Exa_ListExamQuestions (&Exams,&Exam); + } } static void Exa_ReceiveExamFieldsFromForm (struct Exa_Exam *Exam, @@ -1620,6 +1889,57 @@ static bool Exa_CheckExamFieldsReceivedFromForm (const struct Exa_Exam *Exam) return NewExamIsCorrect; } +/*****************************************************************************/ +/********************** Create a new set of questions ************************/ +/*****************************************************************************/ + +static void ExaSet_CreateSet (struct ExaSet_Set *Set) + { + extern const char *Txt_Created_new_set_of_questions_X; + + /***** Create a new exam *****/ + Set->SetCod = + DB_QueryINSERTandReturnCode ("can not create new set of questions", + "INSERT INTO exa_sets" + " (ExaCod,SetInd,NumQstsToExam,Title)" + " VALUES" + " (%ld,'N',%ld,%.15lg,%u,'%s','%s')", + Set->ExaCod, + Set->SetInd, + Set->NumQstsToExam, + Set->Title); + + /***** Write success message *****/ + Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_set_of_questions_X, + Set->Title); + } + +/*****************************************************************************/ +/******************** Update an existing set of questions ********************/ +/*****************************************************************************/ + +static void ExaSet_UpdateSet (struct ExaSet_Set *Set) + { + extern const char *Txt_The_set_of_questions_has_been_modified; + + /***** Update the data of the set of questions *****/ + DB_QueryUPDATE ("can not update set of questions", + "UPDATE exa_exams" + " SET ExaCod=%ld," + "SetInd=%u," + "NumQstsToExam=%u," + "Title='%s'" + " WHERE SetCod=%ld", + Set->ExaCod, + Set->SetInd, + Set->NumQstsToExam, + Set->Title, + Set->SetCod); + + /***** Write success message *****/ + Ale_ShowAlert (Ale_SUCCESS,Txt_The_set_of_questions_has_been_modified); + } + /*****************************************************************************/ /**************************** Create a new exam ******************************/ /*****************************************************************************/ @@ -1694,13 +2014,19 @@ unsigned Exa_GetNumQstsExam (long ExaCod) } /*****************************************************************************/ -/************* Put a form to edit/create a question set in exam **************/ +/************ Request the creation or edition of an set of questions *************/ /*****************************************************************************/ -void Exa_RequestNewSet (void) +void ExaSet_RequestCreatOrEditSet (void) { struct Exa_Exams Exams; struct Exa_Exam Exam; + struct ExaSet_Set Set; + bool ItsANewSet; + + /***** Check if I can edit exams *****/ + if (!Exa_CheckIfICanEditExams ()) + Lay_NoPermissionExit (); /***** Reset exams context *****/ Exa_ResetExams (&Exams); @@ -1708,27 +2034,46 @@ void Exa_RequestNewSet (void) /***** Reset exam *****/ Exa_ResetExam (&Exam); + /***** Create set of questions *****/ + ExaSet_ResetSet (&Set); + /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + ItsANewSet = ((Set.SetCod = ExaSet_GetParamSetCod ()) <= 0); + Lay_ShowErrorAndExit ("Wrong set."); + + /***** Get exam data *****/ Exa_GetDataOfExamByCod (&Exam); - /***** Check if exam has events *****/ - if (Exa_CheckIfEditable (&Exam)) - { - /***** Show form to create a new question in this exam *****/ - Exams.ExaCod = Exam.ExaCod; - Tst_RequestSelectTestsForExam (&Exams); - } + /***** Get set data *****/ + if (ItsANewSet) + /* Initialize to empty set */ + ExaSet_ResetSet (&Set); else - Lay_NoPermissionExit (); + /* Get set data from database */ + ExaSet_GetDataOfSetByCod (&Set); - /***** Show current exam *****/ - Exa_ShowOnlyOneExam (&Exams,&Exam, - true, // List exam questions - false); // Do not put form to start new event + /***** Put forms to create/edit a set *****/ + ExaSet_PutFormsEditionSet (&Exams,&Exam,&Set,ItsANewSet); + + /***** Show exams or questions *****/ + if (ItsANewSet) + /* Show exams again */ + Exa_ListAllExams (&Exams); + else + { + /* Show sets of the exam ready to be edited */ + Exa_ListExamSets (&Exams,&Exam); + + /* Show questions of the exam ready to be edited */ + Exa_ListExamQuestions (&Exams,&Exam); + } } + /*****************************************************************************/ /*************** Put a form to edit/create a question in exam ****************/ /*****************************************************************************/ @@ -1745,8 +2090,12 @@ void Exa_RequestNewQuestion (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam from database *****/ Exa_GetDataOfExamByCod (&Exam); /***** Check if exam has events *****/ @@ -1781,8 +2130,12 @@ void Exa_ListQuestionsToSelect (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam from database *****/ Exa_GetDataOfExamByCod (&Exam); /***** Check if exam has events *****/ @@ -1797,7 +2150,7 @@ void Exa_ListQuestionsToSelect (void) } /*****************************************************************************/ -/**************** Write parameter with index of question set *****************/ +/**************** Write parameter with index of set of questions *****************/ /*****************************************************************************/ void Exa_PutParamSetInd (unsigned SetInd) @@ -2006,15 +2359,15 @@ unsigned Exa_GetNextQuestionIndexInExam (long ExaCod,unsigned QstInd) static void Exa_ListExamSets (struct Exa_Exams *Exams,struct Exa_Exam *Exam) { extern const char *Hlp_ASSESSMENT_Exams_question_sets; - extern const char *Txt_Question_sets; - extern const char *Txt_This_exam_has_no_question_sets; + extern const char *Txt_Sets_of_questions; + extern const char *Txt_This_exam_has_no_sets_of_questions; MYSQL_RES *mysql_res; unsigned NumSets; bool ICanEditSets = Exa_CheckIfEditable (Exam); - /***** Get data of question sets from database *****/ + /***** Get data of set of questionss from database *****/ NumSets = (unsigned) - DB_QuerySELECT (&mysql_res,"can not get exam question sets", + DB_QuerySELECT (&mysql_res,"can not get exam set of questionss", "SELECT SetInd," // row[0] "SetCod" // row[1] " FROM exa_sets" @@ -2025,24 +2378,24 @@ static void Exa_ListExamSets (struct Exa_Exams *Exams,struct Exa_Exam *Exam) /***** Begin box *****/ Exams->ExaCod = Exam->ExaCod; if (ICanEditSets) - Box_BoxBegin (NULL,Txt_Question_sets, + Box_BoxBegin (NULL,Txt_Sets_of_questions, Exa_PutIconToAddNewSets,Exams, Hlp_ASSESSMENT_Exams_question_sets,Box_NOT_CLOSABLE); else - Box_BoxBegin (NULL,Txt_Question_sets, + Box_BoxBegin (NULL,Txt_Sets_of_questions, NULL,NULL, Hlp_ASSESSMENT_Exams_question_sets,Box_NOT_CLOSABLE); /***** Show table with sets *****/ if (NumSets) - Exa_ListOneOrMoreSetsForEdition (Exams, + ExaSet_ListOneOrMoreSetsForEdition (Exams, Exam->ExaCod,NumSets,mysql_res, ICanEditSets); else // This exam has no sets - Ale_ShowAlert (Ale_INFO,Txt_This_exam_has_no_question_sets); + Ale_ShowAlert (Ale_INFO,Txt_This_exam_has_no_sets_of_questions); /***** Put button to add a new set in this exam *****/ - if (ICanEditSets) // I can edit question sets + if (ICanEditSets) // I can edit set of questionss Exa_PutButtonToAddNewSet (Exams); /***** Free structure that stores the query result *****/ @@ -2109,22 +2462,22 @@ static void Exa_ListExamQuestions (struct Exa_Exams *Exams,struct Exa_Exam *Exam /************************* List exam sets for edition ************************/ /*****************************************************************************/ -static void Exa_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, - long ExaCod,unsigned NumSets, - MYSQL_RES *mysql_res, - bool ICanEditSets) +static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, + long ExaCod,unsigned NumSets, + MYSQL_RES *mysql_res, + bool ICanEditSets) { - extern const char *Txt_Question_sets; + extern const char *Txt_Sets_of_questions; extern const char *Txt_No_INDEX; extern const char *Txt_Code; extern const char *Txt_Tags; - extern const char *Txt_Question_set; + extern const char *Txt_Set_of_questions; extern const char *Txt_Move_up_X; extern const char *Txt_Move_down_X; extern const char *Txt_Movement_not_allowed; unsigned NumSet; MYSQL_ROW row; - struct Exa_Set Set; + struct ExaSet_Set Set; unsigned SetInd; unsigned MaxSetInd; char StrSetInd[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; @@ -2142,7 +2495,7 @@ static void Exa_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, HTM_TH (1,1,"CT",Txt_No_INDEX); HTM_TH (1,1,"CT",Txt_Code); HTM_TH (1,1,"CT",Txt_Tags); - HTM_TH (1,1,"CT",Txt_Question_set); + HTM_TH (1,1,"CT",Txt_Set_of_questions); HTM_TR_End (); @@ -2153,8 +2506,8 @@ static void Exa_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, { Gbl.RowEvenOdd = NumSet % 2; - /***** Create question set *****/ - Exa_SetConstructor (&Set); + /***** Create set of questions *****/ + ExaSet_ResetSet (&Set); /***** Get set data *****/ row = mysql_fetch_row (mysql_res); @@ -2231,9 +2584,6 @@ static void Exa_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, // Exa_ListSetForEdition (&Set,SetInd,SetExists); HTM_TR_End (); - - /***** Destroy question set *****/ - Exa_SetDestructor (&Set); } /***** End table *****/ @@ -2244,18 +2594,13 @@ static void Exa_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams, /************************** Question set constructor *************************/ /*****************************************************************************/ -static void Exa_SetConstructor (struct Exa_Set *Set) +static void ExaSet_ResetSet (struct ExaSet_Set *Set) { - Set->SetCod = -1L; - } - -/*****************************************************************************/ -/*************************** Question set destructor *************************/ -/*****************************************************************************/ - -static void Exa_SetDestructor (struct Exa_Set *Set) - { - Set->SetCod = -1L; // TODO: Remove + Set->ExaCod = -1L; + Set->SetCod = -1L; + Set->SetInd = 0; + Set->Title[0] = '\0'; + Set->NumQstsToExam = 0; } /*****************************************************************************/ @@ -2458,17 +2803,17 @@ static void Exa_ListQuestionForEdition (const struct Tst_Question *Question, } /*****************************************************************************/ -/*************** Put icon to add a new question set to exam ******************/ +/*************** Put icon to add a new set of questions to exam ******************/ /*****************************************************************************/ static void Exa_PutIconToAddNewSets (void *Exams) { - extern const char *Txt_Add_question_set; + extern const char *Txt_New_set_of_questions; - /***** Put form to create a new question set *****/ - Ico_PutContextualIconToAdd (ActAddOneExaSet,NULL, + /***** Put form to create a new set of questions *****/ + Ico_PutContextualIconToAdd (ActFrmNewExaSet,NULL, Exa_PutParams,Exams, - Txt_Add_question_set); + Txt_New_set_of_questions); } /*****************************************************************************/ @@ -2486,16 +2831,16 @@ static void Exa_PutIconToAddNewQuestions (void *Exams) } /*****************************************************************************/ -/*************** Put button to add new question set to exam ******************/ +/*************** Put button to add new set of questions to exam ******************/ /*****************************************************************************/ static void Exa_PutButtonToAddNewSet (struct Exa_Exams *Exams) { - extern const char *Txt_Add_question_set; + extern const char *Txt_New_set_of_questions; - Frm_StartForm (ActAddOneExaSet); + Frm_StartForm (ActFrmNewExaSet); Exa_PutParams (Exams); - Btn_PutConfirmButton (Txt_Add_question_set); + Btn_PutConfirmButton (Txt_New_set_of_questions); Frm_EndForm (); } @@ -2534,8 +2879,12 @@ void Exa_AddQuestionsToExam (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam from database *****/ Exa_GetDataOfExamByCod (&Exam); /***** Check if exam has events *****/ @@ -2639,35 +2988,35 @@ static unsigned Exa_CountNumQuestionsInList (const struct Exa_Exams *Exams) } /*****************************************************************************/ -/******************* Request the removal of a question set *******************/ +/***************** Request the removal of a set of questions *****************/ /*****************************************************************************/ -void Exa_RequestRemoveSet (void) +void ExaSet_RequestRemoveSet (void) { } /*****************************************************************************/ -/*************************** Remove a question set ***************************/ +/************************* Remove a set of questions *************************/ /*****************************************************************************/ -void Exa_RemoveSet (void) +void ExaSet_RemoveSet (void) { } /*****************************************************************************/ -/************** Move up position of a question set in an exam ****************/ +/************ Move up position of a set of questions in an exam **************/ /*****************************************************************************/ -void Exa_MoveUpSet (void) +void ExaSet_MoveUpSet (void) { } /*****************************************************************************/ -/************* Move down position of a question set in an exam ***************/ +/*********** Move down position of a set of questions in an exam *************/ /*****************************************************************************/ -void Exa_MoveDownSet (void) +void ExaSet_MoveDownSet (void) { } @@ -2690,8 +3039,12 @@ void Exa_RequestRemoveQst (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam from database *****/ Exa_GetDataOfExamByCod (&Exam); /***** Check if exam has events *****/ @@ -2736,8 +3089,12 @@ void Exa_RemoveQst (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam from database *****/ Exa_GetDataOfExamByCod (&Exam); /***** Check if exam has events *****/ @@ -2803,8 +3160,12 @@ void Exa_MoveUpQst (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam from database *****/ Exa_GetDataOfExamByCod (&Exam); /***** Check if exam has events *****/ @@ -2861,8 +3222,12 @@ void Exa_MoveDownQst (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam from database *****/ Exa_GetDataOfExamByCod (&Exam); /***** Check if exam has events *****/ @@ -3001,8 +3366,12 @@ void Exa_RequestNewEvent (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam from database *****/ Exa_GetDataOfExamByCod (&Exam); /***** Show exam *****/ diff --git a/swad_exam.h b/swad_exam.h index f345a46b..463d168f 100644 --- a/swad_exam.h +++ b/swad_exam.h @@ -38,6 +38,9 @@ #define Exa_MAX_CHARS_TITLE (128 - 1) // 127 #define Exa_MAX_BYTES_TITLE ((Exa_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 +#define ExaSet_MAX_CHARS_TITLE (128 - 1) // 127 +#define ExaSet_MAX_BYTES_TITLE ((ExaSet_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 + #define Exa_NUM_ORDERS 3 typedef enum { @@ -61,6 +64,7 @@ struct Exa_ExamSelected bool Selected; // Is this exam selected when seeing match results? }; +/* Exams context */ struct Exa_Exams { bool LstIsRead; // Is the list already read from database... @@ -73,6 +77,7 @@ struct Exa_Exams char *ListQuestions; char *ExaCodsSelected; // String with selected exam codes separated by separator multiple long ExaCod; // Selected/current exam code + long SetCod; // Selected/current set code long EvtCod; // Selected/current match code unsigned SetInd; // Current set index unsigned QstInd; // Current question index @@ -95,9 +100,13 @@ struct Exa_Exam unsigned NumUnfinishedEvts; // Number of unfinished events in the exam }; -struct Exa_Set +struct ExaSet_Set { - long SetCod; + long ExaCod; // Exam code + long SetCod; // Set code + unsigned SetInd; // Set index (position in the exam) + unsigned NumQstsToExam; // Number of questions in this set taht will appear in the exam + char Title[ExaSet_MAX_BYTES_TITLE + 1]; // Title of the set }; /*****************************************************************************/ @@ -123,7 +132,8 @@ void Exa_SetCurrentExaCod (long ExaCod); void Exa_PutParams (void *Exams); void Exa_PutParamExamCod (long ExaCod); long Exa_GetParamExamCod (void); -long Exa_GetParams (struct Exa_Exams *Exams); +long ExaSet_GetParamSetCod (void); +void Exa_GetParams (struct Exa_Exams *Exams); void Exa_GetListExams (struct Exa_Exams *Exams,Exa_Order_t SelectedOrder); void Exa_GetListSelectedExaCods (struct Exa_Exams *Exams); @@ -140,6 +150,7 @@ void Exa_UnhideExam (void); void Exa_RequestCreatOrEditExam (void); +void ExaSet_RecFormSet (void); void Exa_RecFormExam (void); bool Mch_CheckIfMatchIsAssociatedToGrp (long EvtCod,long GrpCod); @@ -147,6 +158,7 @@ unsigned Exa_GetNumQstsExam (long ExaCod); void Exa_RequestNewSet (void); +void ExaSet_RequestCreatOrEditSet (void); void Exa_RequestNewQuestion (void); void Exa_ListQuestionsToSelect (void); @@ -159,11 +171,11 @@ unsigned Exa_GetNextQuestionIndexInExam (long ExaCod,unsigned QstInd); void Exa_AddQuestionsToExam (void); -void Exa_RequestRemoveSet (void); -void Exa_RemoveSet (void); +void ExaSet_RequestRemoveSet (void); +void ExaSet_RemoveSet (void); -void Exa_MoveUpSet (void); -void Exa_MoveDownSet (void); +void ExaSet_MoveUpSet (void); +void ExaSet_MoveDownSet (void); void Exa_RequestRemoveQst (void); void Exa_RemoveQst (void); diff --git a/swad_exam_event.c b/swad_exam_event.c index 5db6b401..500f1748 100644 --- a/swad_exam_event.c +++ b/swad_exam_event.c @@ -1292,22 +1292,22 @@ void ExaEvt_GetAndCheckParameters (struct Exa_Exams *Exams, struct ExaEvt_Event *Event) { /***** Get parameters *****/ - /* Get parameters of exam */ - if ((Exam->ExaCod = Exa_GetParams (Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (Exams); + if (Exams->ExaCod <= 0) + Lay_WrongExamExit (); + Exam->ExaCod = Exams->ExaCod; Grp_GetParamWhichGroups (); - Exa_GetDataOfExamByCod (Exam); - - /* Get exam event code */ if ((Event->EvtCod = ExaEvt_GetParamEvtCod ()) <= 0) - Lay_ShowErrorAndExit ("Code of exam event is missing."); + Lay_WrongEventExit (); + + /***** Get data of exam and event from database *****/ + Exa_GetDataOfExamByCod (Exam); ExaEvt_GetDataOfEventByCod (Event); /***** Ensure parameters are correct *****/ - if (Exam->ExaCod != Event->ExaCod) - Lay_ShowErrorAndExit ("Wrong exam code."); - if (Exam->CrsCod != Gbl.Hierarchy.Crs.CrsCod) - Lay_ShowErrorAndExit ("Event does not belong to this course."); + if (Exam->ExaCod != Event->ExaCod || + Exam->CrsCod != Gbl.Hierarchy.Crs.CrsCod) + Lay_WrongExamExit (); } /*****************************************************************************/ diff --git a/swad_exam_result.c b/swad_exam_result.c index 525cfd54..33fd6550 100644 --- a/swad_exam_result.c +++ b/swad_exam_result.c @@ -164,8 +164,12 @@ void ExaRes_ShowMyExaResultsInExa (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; + + /***** Get data of exam from database *****/ Exa_GetDataOfExamByCod (&Exam); /***** Exam begin *****/ @@ -214,10 +218,12 @@ void ExaRes_ShowMyExaResultsInEvt (void) ExaEvt_ResetEvent (&Event); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; if ((Event.EvtCod = ExaEvt_GetParamEvtCod ()) <= 0) - Lay_ShowErrorAndExit ("Code of event is missing."); + Lay_WrongEventExit (); Exa_GetDataOfExamByCod (&Exam); ExaEvt_GetDataOfEventByCod (&Event); @@ -366,8 +372,10 @@ void ExaRes_ShowAllExaResultsInExa (void) Exa_ResetExam (&Exam); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; Exa_GetDataOfExamByCod (&Exam); /***** Exam begin *****/ @@ -457,10 +465,14 @@ void ExaRes_ShowAllExaResultsInEvt (void) ExaEvt_ResetEvent (&Event); /***** Get parameters *****/ - if ((Exam.ExaCod = Exa_GetParams (&Exams)) <= 0) - Lay_ShowErrorAndExit ("Code of exam is missing."); + Exa_GetParams (&Exams); + if (Exams.ExaCod <= 0) + Lay_WrongExamExit (); + Exam.ExaCod = Exams.ExaCod; if ((Event.EvtCod = ExaEvt_GetParamEvtCod ()) <= 0) - Lay_ShowErrorAndExit ("Code of event is missing."); + Lay_WrongEventExit (); + + /***** Get data of exam and event *****/ Exa_GetDataOfExamByCod (&Exam); ExaEvt_GetDataOfEventByCod (&Event); diff --git a/swad_forum.c b/swad_forum.c index 05a4d9f2..a284d2c4 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -4361,7 +4361,7 @@ static long For_GetThrInMyClipboard (void) MYSQL_RES *mysql_res; MYSQL_ROW row; unsigned long NumRows; - long ThrCod = -1L;; + long ThrCod = -1L; /***** Get if there is a thread ready to move in my clipboard from database *****/ NumRows = DB_QuerySELECT (&mysql_res,"can not check if there is" diff --git a/swad_layout.c b/swad_layout.c index 2b299644..8c31f2f4 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1484,6 +1484,24 @@ void Lay_WrongTypeOfViewExit (void) Lay_ShowErrorAndExit ("Wrong type of view."); } +/*****************************************************************************/ +/************** Write error message and exit when wrong exam *****************/ +/*****************************************************************************/ + +void Lay_WrongExamExit (void) + { + Lay_ShowErrorAndExit ("Wrong exam."); + } + +/*****************************************************************************/ +/************** Write error message and exit when wrong event ****************/ +/*****************************************************************************/ + +void Lay_WrongEventExit (void) + { + Lay_ShowErrorAndExit ("Wrong event."); + } + /*****************************************************************************/ /******* Write error message, close files, remove lock file, and exit ********/ /*****************************************************************************/ diff --git a/swad_layout.h b/swad_layout.h index febf4d4e..05b17b03 100644 --- a/swad_layout.h +++ b/swad_layout.h @@ -73,6 +73,8 @@ void Lay_NotEnoughMemoryExit (void); void Lay_WrongScopeExit (void); void Lay_WrongOrderExit (void); void Lay_WrongTypeOfViewExit (void); +void Lay_WrongExamExit (void); +void Lay_WrongEventExit (void); void Lay_NoPermissionExit (void); void Lay_ShowErrorAndExit (const char *Txt); diff --git a/swad_link.c b/swad_link.c index 8901ca5d..1153e061 100644 --- a/swad_link.c +++ b/swad_link.c @@ -304,7 +304,7 @@ void Lnk_GetListLinks (void) /***** Create list with places *****/ if ((Gbl.Links.Lst = (struct Link *) calloc (NumRows,sizeof (struct Link))) == NULL) - Lay_NotEnoughMemoryExit ();; + Lay_NotEnoughMemoryExit (); /***** Get the links *****/ for (NumLnk = 0; diff --git a/swad_test_exam.c b/swad_test_exam.c index 9abd99f3..2751cf51 100644 --- a/swad_test_exam.c +++ b/swad_test_exam.c @@ -2352,7 +2352,7 @@ void TstRes_GetExamQuestionsFromDB (struct TstRes_Result *Result) DB_FreeMySQLResult (&mysql_res); if (NumQsts != Result->NumQsts) - Lay_ShowErrorAndExit ("Wrong exam."); + Lay_WrongExamExit (); } /*****************************************************************************/ diff --git a/swad_text.c b/swad_text.c index 514214b8..5625e53e 100644 --- a/swad_text.c +++ b/swad_text.c @@ -931,6 +931,69 @@ const char *Txt_Action = "Ação"; #endif +const char *Txt_Add_questions = +#if L==1 // ca + "Afegir preguntes"; +#elif L==2 // de + "Fügen Fragen"; +#elif L==3 // en + "Add questions"; +#elif L==4 // es + "Añadir preguntas"; +#elif L==5 // fr + "Ajouter questions"; +#elif L==6 // gn + "Añadir preguntas"; // Okoteve traducción +#elif L==7 // it + "Aggiungere domande"; +#elif L==8 // pl + "Dodaj pytania"; +#elif L==9 // pt + "Adicionar perguntas"; +#endif + +const char *Txt_Add_this_ID = +#if L==1 // ca + "Afegir aquest ID"; +#elif L==2 // de + "Fügen Sie diese Ausweis-Nr."; +#elif L==3 // en + "Add this ID"; +#elif L==4 // es + "Añadir este ID"; +#elif L==5 // fr + "Ajouter ce numéro d'identité"; +#elif L==6 // gn + "Añadir este ID"; // Okoteve traducción +#elif L==7 // it + "Aggiungere questa carta d'identità"; +#elif L==8 // pl + "Dodaj ten identyfikator"; +#elif L==9 // pt + "Adicionar este nº identif."; +#endif + +const char *Txt_Add_USERS = // Warning: it is very important to include %s in the following sentences +#if L==1 // ca + "Afegir %s"; +#elif L==2 // de + "Fügen %s"; +#elif L==3 // en + "Add %s"; +#elif L==4 // es + "Añadir %s"; +#elif L==5 // fr + "Ajouter %s"; +#elif L==6 // gn + "Añadir %s"; // Okoteve traducción +#elif L==7 // it + "Aggiungere %s"; +#elif L==8 // pl + "Dodaj %s"; +#elif L==9 // pt + "Adicionar %s"; +#endif + const char *Txt_Administer_me = #if L==1 // ca "Administrarme"; @@ -1843,69 +1906,6 @@ const char *Txt_Another_user_s_profile = "Perfil de outro usuário"; #endif -const char *Txt_Add_questions = -#if L==1 // ca - "Afegir preguntes"; -#elif L==2 // de - "Fügen Fragen"; -#elif L==3 // en - "Add questions"; -#elif L==4 // es - "Añadir preguntas"; -#elif L==5 // fr - "Ajouter questions"; -#elif L==6 // gn - "Añadir preguntas"; // Okoteve traducción -#elif L==7 // it - "Aggiungere domande"; -#elif L==8 // pl - "Dodaj pytania"; -#elif L==9 // pt - "Adicionar perguntas"; -#endif - -const char *Txt_Add_this_ID = -#if L==1 // ca - "Afegir aquest ID"; -#elif L==2 // de - "Fügen Sie diese Ausweis-Nr."; -#elif L==3 // en - "Add this ID"; -#elif L==4 // es - "Añadir este ID"; -#elif L==5 // fr - "Ajouter ce numéro d'identité"; -#elif L==6 // gn - "Añadir este ID"; // Okoteve traducción -#elif L==7 // it - "Aggiungere questa carta d'identità"; -#elif L==8 // pl - "Dodaj ten identyfikator"; -#elif L==9 // pt - "Adicionar este nº identif."; -#endif - -const char *Txt_Add_USERS = // Warning: it is very important to include %s in the following sentences -#if L==1 // ca - "Afegir %s"; -#elif L==2 // de - "Fügen %s"; -#elif L==3 // en - "Add %s"; -#elif L==4 // es - "Añadir %s"; -#elif L==5 // fr - "Ajouter %s"; -#elif L==6 // gn - "Añadir %s"; // Okoteve traducción -#elif L==7 // it - "Aggiungere %s"; -#elif L==8 // pl - "Dodaj %s"; -#elif L==9 // pt - "Adicionar %s"; -#endif - const char *Txt_Announcement_created = #if L==1 // ca "Anunci creat."; @@ -25328,6 +25328,27 @@ const char *Txt_New_room = "Nova sala"; #endif +const char *Txt_New_set_of_questions = +#if L==1 // ca + "Nou conjunt de preguntes"; +#elif L==2 // de + "Neue Satz von Fragen"; +#elif L==3 // en + "New set of questions"; +#elif L==4 // es + "Nuevo conjunto de preguntas"; +#elif L==5 // fr + "Nouveau ensemble de questions"; +#elif L==6 // gn + "Nuevo conjunto de preguntas"; // Okoteve traducción +#elif L==7 // it + "Nuova serie di domande"; +#elif L==8 // pl + "Nowy zestaw pytań"; +#elif L==9 // pt + "Novo conjunto de perguntas"; +#endif + const char *Txt_New_TIMELINE_comment = #if L==1 // ca "Nou comentari"; @@ -40836,6 +40857,27 @@ const char *Txt_sessions = "sessões"; #endif +const char *Txt_Set_of_questions = +#if L==1 // ca + "Conjunt de preguntes"; +#elif L==2 // de + "Satz von Fragen"; +#elif L==3 // en + "Set of questions"; +#elif L==4 // es + "Conjunto de preguntas"; +#elif L==5 // fr + "Ensemble de questions"; +#elif L==6 // gn + "Conjunto de preguntas"; // Okoteve traducción +#elif L==7 // it + "Serie di domande"; +#elif L==8 // pl + "Zestaw pytań"; +#elif L==9 // pt + "Conjunto de perguntas"; +#endif + const char *Txt_Set_password = #if L==1 // ca "Establir contrasenya"; @@ -40878,6 +40920,27 @@ const char *Txt_Set_up = "Instalar"; #endif +const char *Txt_Sets_of_questions = +#if L==1 // ca + "Conjunts de preguntes"; +#elif L==2 // de + "Sätze von Fragen"; +#elif L==3 // en + "Sets of questions"; +#elif L==4 // es + "Conjuntos de preguntas"; +#elif L==5 // fr + "Ensembles de questions"; +#elif L==6 // gn + "Conjuntos de preguntas"; // Okoteve traducción +#elif L==7 // it + "Serie di domande"; +#elif L==8 // pl + "Zestawów pytań"; +#elif L==9 // pt + "Conjuntos de perguntas"; +#endif + const char *Txt_Settings = #if L==1 // ca "Configuració"; @@ -51313,6 +51376,27 @@ const char *Txt_There_was_a_problem_sending_an_email_automatically = "Ocorreu um problema ao enviar um email automaticamente."; #endif +const char *Txt_This_exam_has_no_sets_of_questions = +#if L==1 // ca + "Aquest examen no té conjunts de preguntes."; +#elif L==2 // de + "Dieses Prüfung hat keine sätze von Fragen."; +#elif L==3 // en + "This exam has no sets of questions."; +#elif L==4 // es + "Este examen no tiene conjuntos de preguntas."; +#elif L==5 // fr + "Cet examen n'a pas d'ensembles de questions."; +#elif L==6 // gn + "Este examen no tiene conjuntos de preguntas."; // Okoteve traducción +#elif L==7 // it + "Questo esame non ha serie di domande."; +#elif L==8 // pl + "Ten egzamin nie ma zestawów pytań."; +#elif L==9 // pt + "Este exame não tem conjuntos de perguntas."; +#endif + const char *Txt_This_exam_has_no_questions = #if L==1 // ca "Aquest examen no té preguntes."; diff --git a/swad_timeline.c b/swad_timeline.c index 35039c7d..98fe69dd 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -4664,7 +4664,7 @@ static void TL_RemoveCommentMediaAndDBEntries (long PubCod) { MYSQL_RES *mysql_res; MYSQL_ROW row; - long MedCod;; + long MedCod; /***** Remove media associated to comment *****/ if (DB_QuerySELECT (&mysql_res,"can not get media", diff --git a/swad_timetable.c b/swad_timetable.c index 9325616b..7e2a7722 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -329,7 +329,7 @@ void TT_ShowClassTimeTable (void) }; struct TT_Timetable Timetable; bool PrintView = (Gbl.Action.Act == ActPrnCrsTT || - Gbl.Action.Act == ActPrnMyTT);; + Gbl.Action.Act == ActPrnMyTT); Grp_WhichGroups_t WhichGroups; /***** Initializations *****/