diff --git a/swad_changelog.h b/swad_changelog.h index 3ac6b1cf4..e1b2d0fc4 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -128,19 +128,20 @@ // TODO: In Statistics > Degrees, show only degrees with students // TODO: Change layout of confirm / reject registration. Use green and red buttons -// TODO: When editing an existing question, put upper left contextual link to remove the question +// TODO: Ask for confirmation when removing a survey question. /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.179 (2016-04-05)" +#define Log_PLATFORM_VERSION "SWAD 15.179.1 (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.179.1: Apr 05, 2016 Contextual link to remove one test question. (198384 lines) Version 15.179: Apr 05, 2016 Fixed bug when getting a parameter. Ask for confirmation when removing a test question. (198355 lines) 1 change necessary in database: diff --git a/swad_test.c b/swad_test.c index 6f64452f5..7cbebd196 100644 --- a/swad_test.c +++ b/swad_test.c @@ -228,6 +228,10 @@ static void Tst_MoveImagesToDefinitiveDirectories (void); 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_PutParamsRemoveOneQst (void); + static bool Tst_GetQstCod (void); static void Tst_InsertOrUpdateQstIntoDB (void); @@ -4292,17 +4296,22 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback) Tst_GetQstDataFromDB (Stem,Feedback); } - /***** Start form and table *****/ - Act_FormStart (ActRcvTstQst); + /***** Start frame *****/ if (Gbl.Test.QstCod > 0) // The question already has assigned a code { - Par_PutHiddenParamLong ("QstCod",Gbl.Test.QstCod); - sprintf (Title,Txt_Question_code_X,Gbl.Test.QstCod); - Lay_StartRoundFrameTable (NULL,2,Title); + Lay_StartRoundFrame (NULL,Title,Tst_PutIconToRemove); } else - Lay_StartRoundFrameTable (NULL,2,Txt_New_question); + Lay_StartRoundFrame (NULL,Txt_New_question,NULL); + + /***** Start form *****/ + Act_FormStart (ActRcvTstQst); + if (Gbl.Test.QstCod > 0) // The question already has assigned a code + Par_PutHiddenParamLong ("QstCod",Gbl.Test.QstCod); + + /***** Start table *****/ + fprintf (Gbl.F.Out,""); /***** Help for text editor *****/ fprintf (Gbl.F.Out,"" @@ -4609,15 +4618,21 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback) "" ""); - /***** Send button and end frame *****/ + /***** End table *****/ + fprintf (Gbl.F.Out,"
"); + + /***** Send button *****/ if (Gbl.Test.QstCod > 0) // 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 *****/ Tst_FreeTextChoiceAnswers (); } @@ -5464,6 +5479,28 @@ static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden) DB_QueryUPDATE (Query,"can not update the visibility of a tag"); } +/*****************************************************************************/ +/********************* Put icon to remove one question ***********************/ +/*****************************************************************************/ + +static void Tst_PutIconToRemove (void) + { + extern const char *Txt_Remove; + + Lay_PutContextualLink (ActReqRemTstQst,Tst_PutParamsRemoveOneQst, + "remove-on64x64.png",Txt_Remove,NULL); + } + +/*****************************************************************************/ +/****************** Put parameter to remove one question *********************/ +/*****************************************************************************/ + +static void Tst_PutParamsRemoveOneQst (void) + { + Par_PutHiddenParamLong ("QstCod",Gbl.Test.QstCod); + Par_PutHiddenParamChar ("OnlyThisQst",'Y'); + } + /*****************************************************************************/ /******************** Request the removal of a question **********************/ /*****************************************************************************/ @@ -5489,9 +5526,10 @@ void Tst_RequestRemoveQst (void) Par_PutHiddenParamLong ("QstCod",Gbl.Test.QstCod); if (EditingOnlyThisQst) Par_PutHiddenParamChar ("OnlyThisQst",'Y'); - else + else // Editing a list of questions { - if (Tst_GetParamsTst ()) // Get other parameters from the form + /* Get and write other parameters related to the listing of questions */ + if (Tst_GetParamsTst ()) { Sta_WriteParamsDatesSeeAccesses (); Tst_WriteParamEditQst ();