Version19.16

This commit is contained in:
Antonio Cañas Vargas 2019-09-26 21:27:36 +02:00
parent 84bd388258
commit cf2a210545
8 changed files with 353 additions and 255 deletions

View File

@ -2191,7 +2191,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActHidGam */{1660,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_HideGame ,NULL},
/* ActShoGam */{1661,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_UnhideGame ,NULL},
/* ActAddOneGamQst */{1662,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestNewQuestion ,NULL},
/* ActGamLstTstQst */{1666,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_ListQuestionsToSelect ,NULL},
/* ActGamLstTstQst */{1666,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ListTstQuestionsToSelect ,NULL},
/* ActAddTstQstToGam */{1667,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_AddTstQuestionsToGame ,NULL},
/* ActReqRemGamQst */{1664,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestRemoveQst ,NULL},
/* ActRemGamQst */{1665,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RemoveQst ,NULL},

View File

@ -470,12 +470,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.15 (2019-09-26)"
#define Log_PLATFORM_VERSION "SWAD 19.16 (2019-09-26)"
#define CSS_FILE "swad19.15.css"
#define JS_FILE "swad19.15.js"
/*
// Version 19.*: Sep 26, 2019 TODO: Make it impossible to edit (create/delete/move) questions from a game when it has matches. (? lines)
Version 19.16: Sep 26, 2019 Make it impossible to edit a game when it has matches. (246424 lines)
Version 19.15: Sep 26, 2019 Refresh only left part of the teacher's screen when playing a match. (246332 lines)
Version 19.14.6: Sep 26, 2019 Code refactoring related to match refreshing. (246294 lines)
Version 19.14.5: Sep 26, 2019 Code refactoring related to match playing. (246291 lines)

View File

@ -582,6 +582,7 @@ static void Gam_PutFormsToRemEditOneGame (const struct Game *Game,
Ico_PutContextualIconToUnhide (ActShoGam,Anchor,Gam_PutParams);
/***** Put icon to edit game *****/
if (!Game->NumMchs) // Edit only if match has no matches
Ico_PutContextualIconToEdit (ActEdiOneGam,Gam_PutParams);
}
@ -1042,6 +1043,7 @@ void Gam_RequestCreatOrEditGame (void)
extern const char *Hlp_ASSESSMENT_Games_new_game;
extern const char *Hlp_ASSESSMENT_Games_edit_game;
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_You_can_not_edit_a_game_with_matches;
extern const char *Txt_New_game;
extern const char *Txt_Edit_game;
extern const char *Txt_Title;
@ -1058,9 +1060,15 @@ void Gam_RequestCreatOrEditGame (void)
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES);
/***** Get the code of the game *****/
ItsANewGame = ((Game.GamCod = Gam_GetParamGameCod ()) == -1L);
Game.GamCod = Gam_GetParamGameCod ();
/***** Check if game has matches *****/
if ((Game.NumMchs = Gam_GetNumMchsGame (Game.GamCod)))
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
else
{
/***** Get from the database the data of the game *****/
ItsANewGame = (Game.GamCod < 0);
if (ItsANewGame)
{
/***** Put link (form) to create new game *****/
@ -1142,6 +1150,7 @@ void Gam_RequestCreatOrEditGame (void)
if (!ItsANewGame)
Gam_ListGameQuestions (&Game);
}
}
/*****************************************************************************/
/********************* Receive form to create a new game *******************/
@ -1149,6 +1158,7 @@ void Gam_RequestCreatOrEditGame (void)
void Gam_RecFormGame (void)
{
extern const char *Txt_You_can_not_edit_a_game_with_matches;
extern const char *Txt_Already_existed_a_game_with_the_title_X;
extern const char *Txt_You_must_specify_the_title_of_the_game;
struct Game OldGame;
@ -1158,8 +1168,14 @@ void Gam_RecFormGame (void)
char Txt[Cns_MAX_BYTES_TEXT + 1];
/***** Get the code of the game *****/
ItsANewGame = ((NewGame.GamCod = Gam_GetParamGameCod ()) == -1L);
NewGame.GamCod = Gam_GetParamGameCod ();
/***** Check if game has matches *****/
if ((NewGame.NumMchs = Gam_GetNumMchsGame (NewGame.GamCod)))
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
else
{
ItsANewGame = (NewGame.GamCod < 0);
if (!ItsANewGame)
{
/* Get data of the old (current) game from database */
@ -1202,6 +1218,7 @@ void Gam_RecFormGame (void)
}
else
Gam_RequestCreatOrEditGame ();
}
/***** Show games again *****/
Gam_ListAllGames ();
@ -1378,12 +1395,18 @@ unsigned Gam_GetNumQstsGame (long GamCod)
void Gam_RequestNewQuestion (void)
{
extern const char *Txt_You_can_not_edit_a_game_with_matches;
struct Game Game;
/***** Get game code *****/
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
/***** Check if game has matches *****/
if ((Game.NumMchs = Gam_GetNumMchsGame (Game.GamCod)))
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
else
{
/***** Get other parameters *****/
Gam_GetParamOrder ();
Grp_GetParamWhichGrps ();
@ -1391,6 +1414,7 @@ void Gam_RequestNewQuestion (void)
/***** Show form to create a new question in this game *****/
Tst_ShowFormAskSelectTstsForGame (Game.GamCod);
}
/***** Show current game *****/
Gam_ShowOneGame (Game.GamCod,
@ -1399,6 +1423,27 @@ void Gam_RequestNewQuestion (void)
false); // Do not put form to start new match
}
/*****************************************************************************/
/**************** List several test questions for selection ******************/
/*****************************************************************************/
void Gam_ListTstQuestionsToSelect (void)
{
extern const char *Txt_You_can_not_edit_a_game_with_matches;
struct Game Game;
/***** Get game code *****/
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
/***** Check if game has matches *****/
if ((Game.NumMchs = Gam_GetNumMchsGame (Game.GamCod)))
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
else
/***** List several test questions for selection *****/
Tst_ListQuestionsToSelect (Game.GamCod);
}
/*****************************************************************************/
/****************** Write parameter with index of question *******************/
/*****************************************************************************/
@ -1841,6 +1886,7 @@ static void Gam_PutButtonToAddNewQuestions (void)
void Gam_AddTstQuestionsToGame (void)
{
extern const char *Txt_You_can_not_edit_a_game_with_matches;
extern const char *Txt_You_must_select_one_ore_more_questions;
struct Game Game;
const char *Ptr;
@ -1852,6 +1898,11 @@ void Gam_AddTstQuestionsToGame (void)
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
/***** Check if game has matches *****/
if ((Game.NumMchs = Gam_GetNumMchsGame (Game.GamCod)))
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
else
{
/***** Get selected questions *****/
/* Allocate space for selected question codes */
Gam_AllocateListSelectedQuestions ();
@ -1891,6 +1942,7 @@ void Gam_AddTstQuestionsToGame (void)
/***** Free space for selected question codes *****/
Gam_FreeListsSelectedQuestions ();
}
/***** Show current game *****/
Gam_ShowOneGame (Game.GamCod,
@ -1965,17 +2017,22 @@ static void Gam_PutParamsOneQst (void)
void Gam_RequestRemoveQst (void)
{
extern const char *Txt_You_can_not_edit_a_game_with_matches;
extern const char *Txt_Do_you_really_want_to_remove_the_question_X;
extern const char *Txt_Remove_question;
struct Game Game;
unsigned QstInd;
/***** Get parameters *****/
/* Get game code */
/***** Get game code *****/
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
/* Get question index */
/***** Check if game has matches *****/
if ((Game.NumMchs = Gam_GetNumMchsGame (Game.GamCod)))
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
else
{
/***** Get question index *****/
QstInd = Gam_GetParamQstInd ();
/***** Show question and button to remove question *****/
@ -1985,6 +2042,7 @@ void Gam_RequestRemoveQst (void)
Btn_REMOVE_BUTTON,Txt_Remove_question,
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_question_X,
QstInd);
}
/***** Show current game *****/
Gam_ShowOneGame (Game.GamCod,
@ -1999,16 +2057,21 @@ void Gam_RequestRemoveQst (void)
void Gam_RemoveQst (void)
{
extern const char *Txt_You_can_not_edit_a_game_with_matches;
extern const char *Txt_Question_removed;
struct Game Game;
unsigned QstInd;
/***** Get parameters *****/
/* Get game code */
/***** Get game code *****/
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
/* Get question index */
/***** Check if game has matches *****/
if ((Game.NumMchs = Gam_GetNumMchsGame (Game.GamCod)))
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
else
{
/***** Get question index *****/
QstInd = Gam_GetParamQstInd ();
/***** Remove the question from all the tables *****/
@ -2038,6 +2101,7 @@ void Gam_RemoveQst (void)
/***** Write message *****/
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
}
/***** Show current game *****/
Gam_ShowOneGame (Game.GamCod,
@ -2052,18 +2116,23 @@ void Gam_RemoveQst (void)
void Gam_MoveUpQst (void)
{
extern const char *Txt_You_can_not_edit_a_game_with_matches;
extern const char *Txt_The_question_has_been_moved_up;
extern const char *Txt_Movement_not_allowed;
struct Game Game;
unsigned QstIndTop;
unsigned QstIndBottom;
/***** Get parameters *****/
/* Get game code */
/***** Get game code *****/
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
/* Get question index */
/***** Check if game has matches *****/
if ((Game.NumMchs = Gam_GetNumMchsGame (Game.GamCod)))
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
else
{
/***** Get question index *****/
QstIndBottom = Gam_GetParamQstInd ();
/***** Move up question *****/
@ -2082,6 +2151,7 @@ void Gam_MoveUpQst (void)
}
else
Ale_ShowAlert (Ale_WARNING,Txt_Movement_not_allowed);
}
/***** Show current game *****/
Gam_ShowOneGame (Game.GamCod,
@ -2096,6 +2166,7 @@ void Gam_MoveUpQst (void)
void Gam_MoveDownQst (void)
{
extern const char *Txt_You_can_not_edit_a_game_with_matches;
extern const char *Txt_The_question_has_been_moved_down;
extern const char *Txt_Movement_not_allowed;
extern const char *Txt_This_game_has_no_questions;
@ -2104,15 +2175,19 @@ void Gam_MoveDownQst (void)
unsigned QstIndBottom;
unsigned MaxQstInd; // 0 if no questions
/***** Get parameters *****/
/* Get game code */
/***** Get game code *****/
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
/* Get question index */
/***** Check if game has matches *****/
if ((Game.NumMchs = Gam_GetNumMchsGame (Game.GamCod)))
Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_edit_a_game_with_matches);
else
{
/***** Get question index *****/
QstIndTop = Gam_GetParamQstInd ();
/* Get maximum question index */
/***** Get maximum question index *****/
MaxQstInd = Gam_GetMaxQuestionIndexInGame (Game.GamCod);
/***** Move down question *****/
@ -2136,6 +2211,7 @@ void Gam_MoveDownQst (void)
}
else
Ale_ShowAlert (Ale_WARNING,Txt_This_game_has_no_questions);
}
/***** Show current game *****/
Gam_ShowOneGame (Game.GamCod,

View File

@ -103,6 +103,8 @@ void Gam_RemoveGamesCrs (long CrsCod);
unsigned Gam_GetNumQstsGame (long GamCod);
void Gam_RequestNewQuestion (void);
void Gam_ListTstQuestionsToSelect (void);
void Gam_PutParamQstInd (unsigned QstInd);
unsigned Gam_GetParamQstInd (void);
unsigned Gam_GetQstIndFromStr (const char *UnsignedStr);

View File

@ -1946,6 +1946,10 @@ static void Mch_ShowMatchStatusForStd (struct Match *Match)
unsigned Gam_GetNumMchsGame (long GamCod)
{
/***** Trivial check *****/
if (GamCod < 0) // A non-existing game...
return 0; // ...has no matches
/***** Get number of matches in a game from database *****/
return
(unsigned) DB_QueryCOUNT ("can not get number of matches of a game",

View File

@ -2413,16 +2413,11 @@ void Tst_ListQuestionsToEdit (void)
/**************** List several test questions for selection ******************/
/*****************************************************************************/
void Tst_ListQuestionsToSelect (void)
void Tst_ListQuestionsToSelect (long GamCod)
{
long GamCod;
MYSQL_RES *mysql_res;
unsigned long NumRows;
/***** Get game code *****/
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of game is missing.");
/***** Get parameters, query the database and list the questions *****/
if (Tst_GetParamsTst (Tst_SELECT_QUESTIONS_FOR_GAME)) // Get parameters from the form
{

View File

@ -150,7 +150,7 @@ void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback);
void Tst_ShowFormAskEditTsts (void);
void Tst_ShowFormAskSelectTstsForGame (long GamCod);
void Tst_ListQuestionsToEdit (void);
void Tst_ListQuestionsToSelect (void);
void Tst_ListQuestionsToSelect (long GamCod);
bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res);
void Tst_WriteParamEditQst (void);
unsigned Tst_GetNumAnswersQst (long QstCod);

View File

@ -54243,6 +54243,28 @@ const char *Txt_You_can_not_disable_file_uploading_once_folders_have_been_create
" uma vez diret&oacute;rios foram criados.";
#endif
const char *Txt_You_can_not_edit_a_game_with_matches =
#if L==1 // ca
"No es pot editar un joc amb partides.";
#elif L==2 // de
"Sie k&ouml;nnen ein Spiel mit Matche nicht bearbeiten.";
#elif L==3 // en
"You can not edit a game with matches.";
#elif L==4 // es
"No se puede editar un juego con partidas.";
#elif L==5 // fr
"Vous ne pouvez pas &eacute;diter un jeu avec des matchs.";
#elif L==6 // gn
"No se puede editar un juego con partidas."; // Okoteve traducción
#elif L==7 // it
"Non &egrave; possibile modificare un gioco con i partite.";
#elif L==8 // pl
"Nie mo&zdot;na edytowa&cacute; gry za pomoc&aogon; mecze.";
#elif L==9 // pt
"Voc&ecirc; n&atilde;o pode editar um jogo com partidas.";
#endif
const char *Txt_You_can_not_leave_empty_intermediate_answers =
#if L==1 // ca
"No puede dejar respuestas intermedias sin rellenar."; // Necessita traduccio