diff --git a/swad_changelog.h b/swad_changelog.h
index b76647018..515a51f08 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -132,13 +132,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.180.1 (2016-04-05)"
+#define Log_PLATFORM_VERSION "SWAD 15.180.2 (2016-04-05)"
#define CSS_FILE "swad15.178.2.css"
#define JS_FILE "swad15.178.2.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.180.2: Apr 05, 2016 Contextual link to remove one survey question. (198459 lines)
Version 15.180.1: Apr 05, 2016 Fized minor layout bug in edition of a test question. (198430 lines)
Version 15.180: Apr 05, 2016 Changes in form to edit a test question.
Ask for confirmation when removing a survey question. (198429 lines)
diff --git a/swad_global.h b/swad_global.h
index 01c4b8481..559c8b0bd 100644
--- a/swad_global.h
+++ b/swad_global.h
@@ -696,6 +696,7 @@ struct Globals
long *LstSvyCods; // List of survey codes
tSvysOrderType SelectedOrderType;
long SvyCodToEdit; // Used as parameter in contextual links
+ long SvyQstCodToEdit; // Used as parameter in contextual links
} Svys;
struct
{
diff --git a/swad_survey.c b/swad_survey.c
index b5899397e..16dbaaef6 100644
--- a/swad_survey.c
+++ b/swad_survey.c
@@ -143,6 +143,10 @@ static void Svy_PutButtonToCreateNewQuestion (void);
static void Svy_WriteQstStem (const char *Stem);
static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *SvyQst,bool PutFormAnswerSurvey);
static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs);
+
+static void Svy_PutIconToRemoveOneQst (void);
+static void Svy_PutParamsRemoveOneQst (void);
+
static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod);
static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd);
static void Svy_RegisterIHaveAnsweredSvy (long SvyCod);
@@ -1523,16 +1527,14 @@ void Svy_RequestCreatOrEditSvy (void)
}
/***** Start form *****/
- Gbl.Svys.SvyCodToEdit = ItsANewSurvey ? -1L :
- Svy.SvyCod;
+ Gbl.Svys.SvyCodToEdit = Svy.SvyCod;
Act_FormStart (ItsANewSurvey ? ActNewSvy :
ActChgSvy);
Svy_PutParams ();
- /***** Start frame *****/
- Lay_StartRoundFrameTable (NULL,2,
- ItsANewSurvey ? Txt_New_survey :
- Txt_Edit_survey);
+ /***** Start frame and table *****/
+ Lay_StartRoundFrameTable (NULL,2,ItsANewSurvey ? Txt_New_survey :
+ Txt_Edit_survey);
/***** Survey for anywhere, degree or course? *****/
fprintf (Gbl.F.Out,"
"
@@ -2299,21 +2301,28 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,ch
}
}
+ /***** Start frame *****/
+ if (SvyQst->QstCod > 0) // If the question already has assigned a code
+ {
+ /* Parameters for contextual icon */
+ Gbl.Svys.SvyCodToEdit = SvyCod;
+ Gbl.Svys.SvyQstCodToEdit = SvyQst->QstCod;
+
+ sprintf (Gbl.Title,"%s %u",
+ Txt_Question,SvyQst->QstInd + 1); // Question index may be 0, 1, 2, 3,...
+ Lay_StartRoundFrame (NULL,Gbl.Title,Svy_PutIconToRemoveOneQst);
+ }
+ else
+ Lay_StartRoundFrame (NULL,Txt_New_question,NULL);
+
/***** Start form *****/
Act_FormStart (ActRcvSvyQst);
Svy_PutParamSvyCod (SvyCod);
if (SvyQst->QstCod > 0) // If the question already has assigned a code
Svy_PutParamQstCod (SvyQst->QstCod);
- /***** Start frame *****/
- if (SvyQst->QstCod > 0) // If the question already has assigned a code
- {
- sprintf (Gbl.Title,"%s %u",
- Txt_Question,SvyQst->QstInd + 1); // Question index may be 0, 1, 2, 3,...
- Lay_StartRoundFrameTable (NULL,2,Gbl.Title);
- }
- else
- Lay_StartRoundFrameTable (NULL,2,Txt_New_question);
+ /***** Start table *****/
+ fprintf (Gbl.F.Out,"");
/***** Stem *****/
fprintf (Gbl.F.Out,""
@@ -2383,15 +2392,22 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,ch
""
"
");
- /***** Send button and end frame *****/
+ /***** End table *****/
+ fprintf (Gbl.F.Out,"
");
+
+ /***** Send button *****/
if (SvyQst->QstCod > 0) // If the question already has assigned a code
- Lay_EndRoundFrameTableWithButton (Lay_CONFIRM_BUTTON,Txt_Save);
+ Lay_PutConfirmButton (Txt_Save);
else
- Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_question);
+ Lay_PutCreateButton (Txt_Create_question);
/***** End form *****/
Act_FormEnd ();
+ /***** End frame *****/
+ Lay_EndRoundFrame ();
+
+ /***** Free memory for answers *****/
Svy_FreeTextChoiceAnswers (SvyQst,NumAnswers);
}
@@ -3116,6 +3132,28 @@ static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs)
Gbl.Title);
}
+/*****************************************************************************/
+/********************* Put icon to remove one question ***********************/
+/*****************************************************************************/
+
+static void Svy_PutIconToRemoveOneQst (void)
+ {
+ extern const char *Txt_Remove;
+
+ Lay_PutContextualLink (ActReqRemSvyQst,Svy_PutParamsRemoveOneQst,
+ "remove-on64x64.png",Txt_Remove,NULL);
+ }
+
+/*****************************************************************************/
+/****************** Put parameter to remove one question *********************/
+/*****************************************************************************/
+
+static void Svy_PutParamsRemoveOneQst (void)
+ {
+ Svy_PutParamSvyCod (Gbl.Svys.SvyCodToEdit);
+ Svy_PutParamQstCod (Gbl.Svys.SvyQstCodToEdit);
+ }
+
/*****************************************************************************/
/********************** Request the removal of a question ********************/
/*****************************************************************************/
diff --git a/swad_test.c b/swad_test.c
index 2f3f81a5a..2cd685148 100644
--- a/swad_test.c
+++ b/swad_test.c
@@ -230,7 +230,7 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt);
static long Tst_CreateNewTag (long CrsCod,const char *TagTxt);
static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden);
-static void Tst_PutIconToRemove (void);
+static void Tst_PutIconToRemoveOneQst (void);
static void Tst_PutParamsRemoveOneQst (void);
static bool Tst_GetQstCod (void);
@@ -4319,7 +4319,7 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
if (Gbl.Test.QstCod > 0) // The question already has assigned a code
{
sprintf (Title,Txt_Question_code_X,Gbl.Test.QstCod);
- Lay_StartRoundFrame (NULL,Title,Tst_PutIconToRemove);
+ Lay_StartRoundFrame (NULL,Title,Tst_PutIconToRemoveOneQst);
}
else
Lay_StartRoundFrame (NULL,Txt_New_question,NULL);
@@ -5500,7 +5500,7 @@ static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden)
/********************* Put icon to remove one question ***********************/
/*****************************************************************************/
-static void Tst_PutIconToRemove (void)
+static void Tst_PutIconToRemoveOneQst (void)
{
extern const char *Txt_Remove;