diff --git a/swad_changelog.h b/swad_changelog.h index d123f1176..39d8bf185 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -117,12 +117,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.64.15 (2015/12/13)" +#define Log_PLATFORM_VERSION "SWAD 15.64.16 (2015/12/13)" #define CSS_FILE "swad15.64.5.css" // 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.64.16: Dec 13, 2015 Code refactoring in contextual links. + Fixed minor bug in surveys. (187012 lines) Version 15.64.15: Dec 13, 2015 Code refactoring in contextual links. (187025 lines) Version 15.64.14: Dec 13, 2015 Code refactoring in contextual links. (187037 lines) Version 15.64.13: Dec 13, 2015 Code refactoring in contextual links. (187031 lines) diff --git a/swad_survey.c b/swad_survey.c index 55fedbf73..979073ea0 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -137,7 +137,7 @@ static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod); static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQst); static void Svy_WriteParamEditQst (struct SurveyQuestion *SvyQst); static void Svy_WriteQstStem (const char *Stem); -static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *SvyQst); +static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *SvyQst,bool PutFormAnswerSurvey); static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs); static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod); static void Svy_IncreaseAnswerInDB (long QstCod,unsigned AnsInd); @@ -761,7 +761,8 @@ static void Svy_PutFormsToRemEditOneSvy (long SvyCod,bool Visible) static void Svy_PutParams (void) { - Svy_PutParamSvyCod (Gbl.Svys.SvyCodToEdit); + if (Gbl.Svys.SvyCodToEdit > 0) + Svy_PutParamSvyCod (Gbl.Svys.SvyCodToEdit); Att_PutHiddenParamAttOrderType (); Grp_PutParamWhichGrps (); Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); @@ -1196,17 +1197,15 @@ void Svy_AskRemSurvey (void) if (!Svy.Status.ICanEdit) Lay_ShowErrorAndExit ("You can not remove this survey."); - /***** Button of confirmation of removing *****/ - Act_FormStart (ActRemSvy); - Svy_PutParamSvyCod (Svy.SvyCod); - Svy_PutHiddenParamSvyOrderType (); - Grp_PutParamWhichGrps (); - Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); - /***** Ask for confirmation of removing *****/ sprintf (Gbl.Message,Txt_Do_you_really_want_to_remove_the_survey_X, Svy.Title); Lay_ShowAlert (Lay_WARNING,Gbl.Message); + + /***** Button of confirmation of removing *****/ + Gbl.Svys.SvyCodToEdit = Svy.SvyCod; + Act_FormStart (ActRemSvy); + Svy_PutParams (); Lay_PutRemoveButton (Txt_Remove_survey); Act_FormEnd (); @@ -1296,17 +1295,15 @@ void Svy_AskResetSurvey (void) if (!Svy.Status.ICanEdit) Lay_ShowErrorAndExit ("You can not reset this survey."); - /***** Button of confirmation of reset *****/ - Act_FormStart (ActRstSvy); - Svy_PutParamSvyCod (Svy.SvyCod); - Svy_PutHiddenParamSvyOrderType (); - Grp_PutParamWhichGrps (); - Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); - /***** Ask for confirmation of reset *****/ sprintf (Gbl.Message,Txt_Do_you_really_want_to_reset_the_survey_X, Svy.Title); Lay_ShowAlert (Lay_WARNING,Gbl.Message); + + /***** Button of confirmation of reset *****/ + Gbl.Svys.SvyCodToEdit = Svy.SvyCod; + Act_FormStart (ActRstSvy); + Svy_PutParams (); Lay_PutConfirmButton (Txt_Reset_survey); Act_FormEnd (); @@ -1501,16 +1498,11 @@ void Svy_RequestCreatOrEditSvy (void) } /***** Start form *****/ - if (ItsANewSurvey) - Act_FormStart (ActNewSvy); - else - { - Act_FormStart (ActChgSvy); - Svy_PutParamSvyCod (Svy.SvyCod); - } - Svy_PutHiddenParamSvyOrderType (); - Grp_PutParamWhichGrps (); - Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); + Gbl.Svys.SvyCodToEdit = ItsANewSurvey ? -1L : + Svy.SvyCod; + Act_FormStart (ItsANewSurvey ? ActNewSvy : + ActChgSvy); + Svy_PutParams (); /***** Start frame *****/ Lay_StartRoundFrameTable (NULL,2, @@ -2774,7 +2766,6 @@ static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod) static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQst) { - extern const char *The_ClassFormBold[The_NUM_THEMES]; extern const char *Txt_Questions; extern const char *Txt_No_INDEX; extern const char *Txt_Type; @@ -2792,7 +2783,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ bool Editing = (Gbl.CurrentAct == ActEdiOneSvy || Gbl.CurrentAct == ActEdiOneSvyQst || Gbl.CurrentAct == ActRcvSvyQst); - bool FormAnswerSurvey = Svy->Status.ICanAnswer && !Editing; + bool PutFormAnswerSurvey = Svy->Status.ICanAnswer && !Editing; /***** Get data of questions from database *****/ sprintf (Query,"SELECT QstCod,QstInd,AnsType,Stem" @@ -2800,7 +2791,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ Svy->SvyCod); NumQsts = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get data of a question"); - if (FormAnswerSurvey) + if (PutFormAnswerSurvey) { /***** Start form to send answers to survey *****/ Act_FormStart (ActAnsSvy); @@ -2893,7 +2884,7 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ fprintf (Gbl.F.Out,"