diff --git a/swad_changelog.h b/swad_changelog.h
index 6b272b422..cc1feb260 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -134,13 +134,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.158 (2016-03-21)"
+#define Log_PLATFORM_VERSION "SWAD 15.158.1 (2016-03-21)"
#define CSS_FILE "swad15.157.css"
#define JS_FILE "swad15.131.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 15.158.1: Mar 21, 2016 Button to add new test question. (196284 lines)
Version 15.158: Mar 21, 2016 Changes in layout of tests. (196274 lines)
Version 15.157.3: Mar 20, 2016 Changes in layout of tests. (196247 lines)
Version 15.157.2: Mar 20, 2016 Fixed bug in surveys. (196241 lines)
diff --git a/swad_test.c b/swad_test.c
index 46f05bbba..1b6bb8439 100644
--- a/swad_test.c
+++ b/swad_test.c
@@ -149,6 +149,7 @@ static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotB
static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst);
static void Tst_UpdateLastAccTst (void);
static void Tst_PutFormToCreateNewTstQst (void);
+static void Tst_PutButtonToAddQuestion (void);
static long Tst_GetParamTagCode (void);
static bool Tst_CheckIfCurrentCrsHasTestTags (void);
static unsigned long Tst_GetAllTagsFromCurrentCrs (MYSQL_RES **mysql_res);
@@ -245,7 +246,7 @@ void Tst_ShowFormAskTst (void)
extern const char *Txt_Test;
extern const char *Txt_No_of_questions;
extern const char *Txt_Generate_exam;
- extern const char *Txt_No_test_questions_in_X;
+ extern const char *Txt_No_test_questions;
MYSQL_RES *mysql_res;
unsigned long NumRows;
bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT ||
@@ -309,9 +310,11 @@ void Tst_ShowFormAskTst (void)
}
else
{
- sprintf (Gbl.Message,Txt_No_test_questions_in_X,
- Gbl.CurrentCrs.Crs.FullName);
- Lay_ShowAlert (Lay_INFO,Gbl.Message);
+ /***** Warning message *****/
+ Lay_ShowAlert (Lay_INFO,Txt_No_test_questions);
+
+ /***** Button to create a new question *****/
+ Tst_PutButtonToAddQuestion ();
}
/***** End frame *****/
@@ -1107,7 +1110,7 @@ void Tst_SetIniEndDates (void)
void Tst_ShowFormAskEditTsts (void)
{
- extern const char *Txt_No_test_questions_in_X;
+ extern const char *Txt_No_test_questions;
extern const char *Txt_Questions;
extern const char *Txt_Show_questions;
MYSQL_RES *mysql_res;
@@ -1120,18 +1123,12 @@ void Tst_ShowFormAskEditTsts (void)
Tst_PutFormToConfigure (); // Put form to go to test configuration
fprintf (Gbl.F.Out,"");
- /***** Get tags already present in the table of questions *****/
- if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res)) == 0)
- {
- sprintf (Gbl.Message,Txt_No_test_questions_in_X,
- Gbl.CurrentCrs.Crs.FullName);
- Lay_ShowAlert (Lay_INFO,Gbl.Message);
- }
- else
- {
- /***** Start frame *****/
- Lay_StartRoundFrame (NULL,Txt_Questions,NULL);
+ /***** Start frame *****/
+ Lay_StartRoundFrame (NULL,Txt_Questions,NULL);
+ /***** Get tags already present in the table of questions *****/
+ if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res)))
+ {
Act_FormStart (ActLstTstQst);
Par_PutHiddenParamUnsigned ("Order",(unsigned) Tst_ORDER_STEM);
@@ -1150,10 +1147,18 @@ void Tst_ShowFormAskEditTsts (void)
/***** Send button *****/
Lay_PutConfirmButton (Txt_Show_questions);
Act_FormEnd ();
-
- /***** End frame *****/
- Lay_EndRoundFrame ();
}
+ else // No test questions
+ {
+ /***** Warning message *****/
+ Lay_ShowAlert (Lay_INFO,Txt_No_test_questions);
+
+ /***** Button to create a new question *****/
+ Tst_PutButtonToAddQuestion ();
+ }
+
+ /***** End frame *****/
+ Lay_EndRoundFrame ();
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
@@ -1172,6 +1177,19 @@ static void Tst_PutFormToCreateNewTstQst (void)
Txt_New_question,Txt_New_question);
}
+/*****************************************************************************/
+/**************** Put button to create a new test question *******************/
+/*****************************************************************************/
+
+static void Tst_PutButtonToAddQuestion (void)
+ {
+ extern const char *Txt_New_question;
+
+ Act_FormStart (ActEdiOneTstQst);
+ Lay_PutConfirmButton (Txt_New_question);
+ Act_FormEnd ();
+ }
+
/*****************************************************************************/
/***************************** Form to rename tags ***************************/
/*****************************************************************************/
@@ -1490,7 +1508,7 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
static void Tst_ShowFormEditTags (void)
{
- extern const char *Txt_No_test_questions_in_X;
+ extern const char *Txt_No_test_questions;
extern const char *Txt_Tags;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
@@ -1498,13 +1516,7 @@ static void Tst_ShowFormEditTags (void)
long TagCod;
/***** Get current tags in current course *****/
- if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res)) == 0)
- {
- sprintf (Gbl.Message,Txt_No_test_questions_in_X,
- Gbl.CurrentCrs.Crs.FullName);
- Lay_ShowAlert (Lay_INFO,Gbl.Message);
- }
- else
+ if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res)))
{
/***** Start table *****/
Lay_StartRoundFrameTable (NULL,2,Txt_Tags);
@@ -1542,6 +1554,8 @@ static void Tst_ShowFormEditTags (void)
/***** End table *****/
Lay_EndRoundFrameTable ();
}
+ else
+ Lay_ShowAlert (Lay_INFO,Txt_No_test_questions);
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
diff --git a/swad_text.c b/swad_text.c
index bf11047ed..a60c4f4ce 100644
--- a/swad_text.c
+++ b/swad_text.c
@@ -24349,25 +24349,25 @@ const char *Txt_No_teachers_or_students_found =
"Nenhum professor ou estudante encontrado.";
#endif
-const char *Txt_No_test_questions_in_X = // Warning: it is very important to include %s in the following sentences
+const char *Txt_No_test_questions =
#if L==1
- "No hay preguntas de test en %s."; // Necessita traduccio
+ "No hay preguntas de test."; // Necessita traduccio
#elif L==2
- "Keine Testfragen im %s.";
+ "Keine Testfragen.";
#elif L==3
- "No test questions in %s.";
+ "No test questions.";
#elif L==4
- "No hay preguntas de test en %s.";
+ "No hay preguntas de test.";
#elif L==5
- "Il n'y a pas de questions de test dans %s.";
+ "Il n'y a pas de questions de test.";
#elif L==6
- "No hay preguntas de test en %s."; // Okoteve traducción
+ "No hay preguntas de test."; // Okoteve traducción
#elif L==7
- "Non ci sono domande di test in %s.";
+ "Non ci sono domande di test.";
#elif L==8
- "Brak pytań testowych %s.";
+ "Brak pytań testowych.";
#elif L==9
- "Não existem questões de test em %s.";
+ "Não existem questões de test.";
#endif
const char *Txt_No_user_has_been_eliminated =