diff --git a/swad_action.c b/swad_action.c
index 62d58c467..c8c82b473 100644
--- a/swad_action.c
+++ b/swad_action.c
@@ -85,7 +85,7 @@ extern struct Globals Gbl;
/************************ Internal global variables **************************/
/*****************************************************************************/
/*
-1354 actions in one CGI:
+1372 actions in one CGI:
0. ActAll Any action (used for statistics)
1. ActUnk Unknown action
2. ActHom Show home menu
@@ -426,7 +426,7 @@ Assessment:
289. ActSeeAsg Show assignments
290. ActReqTst Request a test of self-assesment
291. ActSeeAllSvy List all surveys in pages
- NEW. ActSeeAllGam Remote control
+ NEW. ActSeeAllGam Remote control
292. ActSeeAllExaAnn Show the exam announcements
293. ActEdiAss Edit the assessment system
@@ -503,6 +503,7 @@ Assessment:
NEW. ActHidGam Hide game
NEW. ActShoGam Show game
NEW. ActEdiOneGamQst Edit a new question for a game
+ NEW. ActGamLstTstQst List test questions to select one or several questions
NEW. ActRcvGamQst Receive a question of a game
NEW. ActReqRemGamQst Request the removal of a question of a game
NEW. ActRemGamQst Confirm the removal of a question of a game
@@ -1979,6 +1980,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActHidGam */{1660,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_HideGame ,NULL},
/* ActShoGam */{1661,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_UnhideGame ,NULL},
/* ActEdiOneGamQst */{1662,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_RequestEditQuestion ,NULL},
+ /* ActGamLstTstQst */{1666,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Tst_ListQuestionsToSelect ,NULL},
/* ActRcvGamQst */{1663,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_ReceiveQst ,NULL},
/* ActReqRemGamQst */{1664,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_RequestRemoveQst ,NULL},
/* ActRemGamQst */{1665,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Rmt_RemoveQst ,NULL},
@@ -4707,6 +4709,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActRcvGamQst, // #1663
ActReqRemGamQst, // #1664
ActRemGamQst, // #1665
+ ActGamLstTstQst, // #1666
};
/*****************************************************************************/
diff --git a/swad_action.h b/swad_action.h
index 710ad3135..c32c0d19f 100644
--- a/swad_action.h
+++ b/swad_action.h
@@ -57,9 +57,9 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
-#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 33 + 24 + 115 + 89 + 416 + 165 + 172 + 42 + 14 + 97)
+#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 33 + 24 + 115 + 90 + 416 + 165 + 172 + 42 + 14 + 97)
-#define Act_MAX_ACTION_COD 1665
+#define Act_MAX_ACTION_COD 1666
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 12
@@ -515,19 +515,20 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActHidGam (ActChgCalCrs1stDay + 75)
#define ActShoGam (ActChgCalCrs1stDay + 76)
#define ActEdiOneGamQst (ActChgCalCrs1stDay + 77)
-#define ActRcvGamQst (ActChgCalCrs1stDay + 78)
-#define ActReqRemGamQst (ActChgCalCrs1stDay + 79)
-#define ActRemGamQst (ActChgCalCrs1stDay + 80)
+#define ActGamLstTstQst (ActChgCalCrs1stDay + 78)
+#define ActRcvGamQst (ActChgCalCrs1stDay + 79)
+#define ActReqRemGamQst (ActChgCalCrs1stDay + 80)
+#define ActRemGamQst (ActChgCalCrs1stDay + 81)
-#define ActSeeOneExaAnn (ActChgCalCrs1stDay + 81)
-#define ActSeeDatExaAnn (ActChgCalCrs1stDay + 82)
-#define ActEdiExaAnn (ActChgCalCrs1stDay + 83)
-#define ActRcvExaAnn (ActChgCalCrs1stDay + 84)
-#define ActPrnExaAnn (ActChgCalCrs1stDay + 85)
-#define ActReqRemExaAnn (ActChgCalCrs1stDay + 86)
-#define ActRemExaAnn (ActChgCalCrs1stDay + 87)
-#define ActHidExaAnn (ActChgCalCrs1stDay + 88)
-#define ActShoExaAnn (ActChgCalCrs1stDay + 89)
+#define ActSeeOneExaAnn (ActChgCalCrs1stDay + 82)
+#define ActSeeDatExaAnn (ActChgCalCrs1stDay + 83)
+#define ActEdiExaAnn (ActChgCalCrs1stDay + 84)
+#define ActRcvExaAnn (ActChgCalCrs1stDay + 85)
+#define ActPrnExaAnn (ActChgCalCrs1stDay + 86)
+#define ActReqRemExaAnn (ActChgCalCrs1stDay + 87)
+#define ActRemExaAnn (ActChgCalCrs1stDay + 88)
+#define ActHidExaAnn (ActChgCalCrs1stDay + 89)
+#define ActShoExaAnn (ActChgCalCrs1stDay + 90)
/*****************************************************************************/
/******************************** Files tab **********************************/
diff --git a/swad_changelog.h b/swad_changelog.h
index 96294b7d8..c44e7cc45 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -236,13 +236,35 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 16.249.5 (2017-07-04)"
+#define Log_PLATFORM_VERSION "SWAD 16.251 (2017-07-16)"
#define CSS_FILE "swad16.235.1.css"
#define JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
+ Version 16.251: Jul 16, 2017 Listing games for remote control. Not finished. (226867 lines)
+ 19 changes necessary in database:
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1648','es','N','Cambiar lugar de centro');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1649','es','N','Ver juegos');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1650','es','N','Ver un juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1651','es','N','Responder juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1652','es','N','Solicitar creación juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1653','es','N','Solicitar edición juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1654','es','N','Crear juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1655','es','N','Modificar juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1656','es','N','Solicitar elim. juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1657','es','N','Eliminar juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1658','es','N','Solicitar puesta a cero juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1659','es','N','Poner a cero juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1660','es','N','Ocultar juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1661','es','N','Mostrar juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1662','es','N','Solicitar selec. tests para juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1663','es','N','Enviar pregunta juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1664','es','N','Preguntar si eliminar pregunta juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1665','es','N','Eliminar pregunta juego');
+INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1666','es','N','Selec. descriptores tests para juego');
+
Version 16.250: Jul 09, 2017 Listing games for remote control. Not finished. (226738 lines)
5 changes necessary in database:
CREATE TABLE IF NOT EXISTS games (GamCod INT NOT NULL AUTO_INCREMENT,Scope ENUM('Sys','Cty','Ins','Ctr','Deg','Crs') NOT NULL DEFAULT 'Sys',Cod INT NOT NULL DEFAULT -1,Hidden ENUM('N','Y') NOT NULL DEFAULT 'N',NumNotif INT NOT NULL DEFAULT 0,Roles INT NOT NULL DEFAULT 0,UsrCod INT NOT NULL,StartTime DATETIME NOT NULL,EndTime DATETIME NOT NULL,Title VARCHAR(2047) NOT NULL,Txt TEXT NOT NULL,UNIQUE INDEX(GamCod),INDEX(Scope,Cod));
diff --git a/swad_remote_control.c b/swad_remote_control.c
index f9e81895a..0cd04f4a3 100644
--- a/swad_remote_control.c
+++ b/swad_remote_control.c
@@ -41,6 +41,7 @@
#include "swad_remote_control.h"
#include "swad_role.h"
#include "swad_table.h"
+#include "swad_test.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
@@ -111,8 +112,6 @@ static void Rmt_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
unsigned *HiddenAllowed);
static void Rmt_GetGameTxtFromDB (long GamCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
-static void Rmt_PutParamGameCod (long GamCod);
-static long Rmt_GetParamGameCod (void);
static void Rmt_PutButtonToResetGame (void);
@@ -130,8 +129,6 @@ static void Rmt_GetAndWriteNamesOfGrpsAssociatedToGame (struct Game *Game);
static bool Rmt_CheckIfICanDoThisGameBasedOnGrps (long GamCod);
static unsigned Rmt_GetNumQstsGame (long GamCod);
-static void Rmt_ShowFormEditOneQst (long GamCod,struct GameQuestion *GameQst,
- char Txt[Cns_MAX_BYTES_TEXT + 1]);
static void Rmt_InitQst (struct GameQuestion *GameQst);
static void Rmt_PutParamQstCod (long QstCod);
static long Rmt_GetParamQstCod (void);
@@ -169,8 +166,6 @@ void Rmt_SeeAllGames (void)
{
struct GameQuestion GameQst;
- Ale_ShowAlert (Ale_INFO,"Under development.");
-
/***** Get parameters *****/
Rmt_GetParamGameOrder ();
Grp_GetParamWhichGrps ();
@@ -1461,7 +1456,7 @@ void Rmt_GetNotifGame (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
/******************* Write parameter with code of game *********************/
/*****************************************************************************/
-static void Rmt_PutParamGameCod (long GamCod)
+void Rmt_PutParamGameCod (long GamCod)
{
Par_PutHiddenParamLong ("GamCod",GamCod);
}
@@ -1470,7 +1465,7 @@ static void Rmt_PutParamGameCod (long GamCod)
/******************** Get parameter with code of game **********************/
/*****************************************************************************/
-static long Rmt_GetParamGameCod (void)
+long Rmt_GetParamGameCod (void)
{
/***** Get code of game *****/
return Par_GetParToLong ("GamCod");
@@ -1534,19 +1529,19 @@ void Rmt_RemoveGame (void)
Lay_ShowErrorAndExit ("You can not remove this game.");
/***** Remove all the users in this game *****/
- sprintf (Query,"DELETE FROM game_users WHERE GamCod=%ld",
+ sprintf (Query,"DELETE FROM gam_users WHERE GamCod=%ld",
Game.GamCod);
DB_QueryDELETE (Query,"can not remove users who are answered a game");
/***** Remove all the answers in this game *****/
- sprintf (Query,"DELETE FROM gam_answers USING game_questions,gam_answers"
- " WHERE game_questions.GamCod=%ld"
- " AND game_questions.QstCod=gam_answers.QstCod",
+ sprintf (Query,"DELETE FROM gam_answers USING gam_questions,gam_answers"
+ " WHERE gam_questions.GamCod=%ld"
+ " AND gam_questions.QstCod=gam_answers.QstCod",
Game.GamCod);
DB_QueryDELETE (Query,"can not remove answers of a game");
/***** Remove all the questions in this game *****/
- sprintf (Query,"DELETE FROM game_questions"
+ sprintf (Query,"DELETE FROM gam_questions"
" WHERE GamCod=%ld",
Game.GamCod);
DB_QueryDELETE (Query,"can not remove questions of a game");
@@ -1643,14 +1638,14 @@ void Rmt_ResetGame (void)
Lay_ShowErrorAndExit ("You can not reset this game.");
/***** Remove all the users in this game *****/
- sprintf (Query,"DELETE FROM game_users WHERE GamCod=%ld",
+ sprintf (Query,"DELETE FROM gam_users WHERE GamCod=%ld",
Game.GamCod);
DB_QueryDELETE (Query,"can not remove users who are answered a game");
/***** Reset all the answers in this game *****/
- sprintf (Query,"UPDATE gam_answers,game_questions SET gam_answers.NumUsrs=0"
- " WHERE game_questions.GamCod=%ld"
- " AND game_questions.QstCod=gam_answers.QstCod",
+ sprintf (Query,"UPDATE gam_answers,gam_questions SET gam_answers.NumUsrs=0"
+ " WHERE gam_questions.GamCod=%ld"
+ " AND gam_questions.QstCod=gam_answers.QstCod",
Game.GamCod);
DB_QueryUPDATE (Query,"can not reset answers of a game");
@@ -2474,28 +2469,28 @@ void Rmt_RemoveGames (Sco_Scope_t Scope,long Cod)
char Query[512];
/***** Remove all the users in course games *****/
- sprintf (Query,"DELETE FROM game_users"
- " USING games,game_users"
+ sprintf (Query,"DELETE FROM gam_users"
+ " USING games,gam_users"
" WHERE games.Scope='%s' AND games.Cod=%ld"
- " AND games.GamCod=game_users.GamCod",
+ " AND games.GamCod=gam_users.GamCod",
Sco_ScopeDB[Scope],Cod);
DB_QueryDELETE (Query,"can not remove users"
" who had answered games in a place on the hierarchy");
/***** Remove all the answers in course games *****/
sprintf (Query,"DELETE FROM gam_answers"
- " USING games,game_questions,gam_answers"
+ " USING games,gam_questions,gam_answers"
" WHERE games.Scope='%s' AND games.Cod=%ld"
- " AND games.GamCod=game_questions.GamCod"
- " AND game_questions.QstCod=gam_answers.QstCod",
+ " AND games.GamCod=gam_questions.GamCod"
+ " AND gam_questions.QstCod=gam_answers.QstCod",
Sco_ScopeDB[Scope],Cod);
DB_QueryDELETE (Query,"can not remove answers of games in a place on the hierarchy");
/***** Remove all the questions in course games *****/
- sprintf (Query,"DELETE FROM game_questions"
- " USING games,game_questions"
+ sprintf (Query,"DELETE FROM gam_questions"
+ " USING games,gam_questions"
" WHERE games.Scope='%s' AND games.Cod=%ld"
- " AND games.GamCod=game_questions.GamCod",
+ " AND games.GamCod=gam_questions.GamCod",
Sco_ScopeDB[Scope],Cod);
DB_QueryDELETE (Query,"can not remove questions of games in a place on the hierarchy");
@@ -2543,7 +2538,7 @@ static unsigned Rmt_GetNumQstsGame (long GamCod)
char Query[128];
/***** Get data of questions from database *****/
- sprintf (Query,"SELECT COUNT(*) FROM game_questions WHERE GamCod=%ld",
+ sprintf (Query,"SELECT COUNT(*) FROM gam_questions WHERE GamCod=%ld",
GamCod);
return (unsigned) DB_QueryCOUNT (Query,"can not get number of questions of a game");
}
@@ -2556,11 +2551,9 @@ void Rmt_RequestEditQuestion (void)
{
long GamCod;
struct GameQuestion GameQst;
- char Txt[Cns_MAX_BYTES_TEXT + 1];
/***** Initialize question to zero *****/
Rmt_InitQst (&GameQst);
- Txt[0] = '\0';
/***** Get game code *****/
if ((GamCod = Rmt_GetParamGameCod ()) == -1L)
@@ -2575,201 +2568,12 @@ void Rmt_RequestEditQuestion (void)
Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS);
/***** Show form to create a new question in this game *****/
- Rmt_ShowFormEditOneQst (GamCod,&GameQst,Txt);
+ Tst_ShowFormAskSelectTstsForGame (GamCod);
/***** Show current game *****/
Rmt_ShowOneGame (GamCod,&GameQst,true);
}
-/*****************************************************************************/
-/******************* Show form to edit one game question *******************/
-/*****************************************************************************/
-
-static void Rmt_ShowFormEditOneQst (long GamCod,struct GameQuestion *GameQst,
- char Txt[Cns_MAX_BYTES_TEXT + 1])
- {
- extern const char *Hlp_ASSESSMENT_Games_questions;
- extern const char *The_ClassForm[The_NUM_THEMES];
- extern const char *Txt_Question;
- extern const char *Txt_New_question;
- extern const char *Txt_Stem;
- extern const char *Txt_Type;
- extern const char *Txt_SURVEY_STR_ANSWER_TYPES[Rmt_NUM_ANS_TYPES];
- extern const char *Txt_Save;
- extern const char *Txt_Create_question;
- char Query[256];
- MYSQL_RES *mysql_res;
- MYSQL_ROW row;
- unsigned NumAns;
- unsigned NumAnswers = 0;
- Rmt_AnswerType_t AnsType;
-
- if (Gbl.Action.Act == ActEdiOneGamQst) // If no receiving the question, but editing a new or existing question
- {
- if ((GameQst->QstCod > 0)) // If parameter QstCod received ==> question already exists in the database
- {
- /***** Get the type of answer and the stem from the database *****/
- /* Get the question from database */
- sprintf (Query,"SELECT QstInd,AnsType,Stem FROM game_questions"
- " WHERE QstCod=%ld AND GamCod=%ld",
- GameQst->QstCod,GamCod);
- DB_QuerySELECT (Query,&mysql_res,"can not get a question");
-
- row = mysql_fetch_row (mysql_res);
-
- /* Get question index inside game (row[0]) */
- if (sscanf (row[0],"%u",&(GameQst->QstInd)) != 1)
- Lay_ShowErrorAndExit ("Error: wrong question index.");
-
- /* Get the type of answer (row[1]) */
- GameQst->AnswerType = Rmt_ConvertFromStrAnsTypDBToAnsTyp (row[1]);
-
- /* Get the stem of the question from the database (row[2]) */
- Str_Copy (Txt,row[2],
- Cns_MAX_BYTES_TEXT);
-
- /* Free structure that stores the query result */
- DB_FreeMySQLResult (&mysql_res);
-
- /***** Get the answers from the database *****/
- NumAnswers = Rmt_GetAnswersQst (GameQst->QstCod,&mysql_res); // Result: AnsInd,NumUsrs,Answer
- for (NumAns = 0;
- NumAns < NumAnswers;
- NumAns++)
- {
- row = mysql_fetch_row (mysql_res);
-
- if (NumAnswers > Rmt_MAX_ANSWERS_PER_QUESTION)
- Lay_ShowErrorAndExit ("Wrong answer.");
- if (!Rmt_AllocateTextChoiceAnswer (GameQst,NumAns))
- Lay_ShowErrorAndExit (Gbl.Alert.Txt);
-
- Str_Copy (GameQst->AnsChoice[NumAns].Text,row[2],
- Rmt_MAX_BYTES_ANSWER);
- }
- /* Free structure that stores the query result */
- DB_FreeMySQLResult (&mysql_res);
- }
- }
-
- /***** Start box *****/
- if (GameQst->QstCod > 0) // If the question already has assigned a code
- {
- /* Parameters for contextual icon */
- Gbl.Games.GamCodToEdit = GamCod;
- Gbl.Games.GamQstCodToEdit = GameQst->QstCod;
-
- sprintf (Gbl.Title,"%s %u",
- Txt_Question,GameQst->QstInd + 1); // Question index may be 0, 1, 2, 3,...
- Box_StartBox (NULL,Gbl.Title,Rmt_PutIconToRemoveOneQst,
- NULL,Box_NOT_CLOSABLE);
- }
- else
- Box_StartBox (NULL,Txt_New_question,NULL,
- Hlp_ASSESSMENT_Games_questions,Box_NOT_CLOSABLE);
-
- /***** Start form *****/
- Act_FormStart (ActRcvGamQst);
- Rmt_PutParamGameCod (GamCod);
- if (GameQst->QstCod > 0) // If the question already has assigned a code
- Rmt_PutParamQstCod (GameQst->QstCod);
-
- /***** Start table *****/
- Tbl_StartTableWide (2);
-
- /***** Stem *****/
- fprintf (Gbl.F.Out,"
"
- "
"
- ""
- "
"
- "
"
- ""
- "
"
- "
",
- The_ClassForm[Gbl.Prefs.Theme],Txt_Stem,
- Txt);
-
- /***** Type of answer *****/
- fprintf (Gbl.F.Out,"
");
- Tbl_StartTable (2);
- for (NumAns = 0;
- NumAns < Rmt_MAX_ANSWERS_PER_QUESTION;
- NumAns++)
- {
- /* Label with the number of the answer */
- fprintf (Gbl.F.Out,"
");
+ Tbl_StartTable (2);
+ for (NumAns = 0;
+ NumAns < Rmt_MAX_ANSWERS_PER_QUESTION;
+ NumAns++)
+ {
+ * Label with the number of the answer *
+ fprintf (Gbl.F.Out,"