From 008890a568e7b994c7dd6a55a0b2b3e07c8a629f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sun, 20 Mar 2016 02:48:16 +0100 Subject: [PATCH] Version 15.155.2 --- swad_changelog.h | 7 ++- swad_survey.c | 120 +++++++++++++++++++++++++++++------------------ swad_text.c | 24 +++++----- 3 files changed, 91 insertions(+), 60 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index d12a2a430..4fd878086 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -124,6 +124,7 @@ // TODO: Important!!!! E-mail should not be visible for not logged users // TODO: Fix bug in marks reported by Francisco Ocaña // TODO: When a new user (a guest not registered in any course) creates a new course ==> register him/her automatically as a teacher in the course just created +// TODO: Change icon to reset survey (distinct from recycle, color red) // TODO: Icon to the left in list of forums is not correct when scope is system // TODO: Move info about number of files to bottom of file browsers @@ -132,14 +133,16 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.155.1 (2016-03-20)" +#define Log_PLATFORM_VERSION "SWAD 15.155.2 (2016-03-20)" #define CSS_FILE "swad15.152.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.155.1: Mar 20, 2016 Icon to print list of attendance integrated in frame. (? lines) + Version 15.155.2: Mar 20, 2016 Fixed bug in surveys. + Changes in edition of questions of surveys. (196060 lines) + Version 15.155.1: Mar 20, 2016 Icon to print list of attendance integrated in frame. (196042 lines) Version 15.155: Mar 20, 2016 Icon to add new attendance event integrated in frame. Changes in layout of attendance events. (196038 lines) Version 15.154: Mar 19, 2016 Icon to add new survey integrated in frame. diff --git a/swad_survey.c b/swad_survey.c index 84f6606e1..4370d1097 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -106,6 +106,9 @@ static void Svy_PutParams (void); static void Svy_GetSurveyTxtFromDB (long SvyCod,char *Txt); static void Svy_PutParamSvyCod (long SvyCod); static long Svy_GetParamSvyCod (void); + +static void Svy_PutButtonToResetSurvey (void); + static bool Svy_CheckIfSimilarSurveyExists (struct Survey *Svy); static bool Svy_SetDefaultAndAllowedForEdition (void); static void Svy_ShowLstGrpsToEditSurvey (long SvyCod); @@ -135,6 +138,8 @@ static void Svy_FreeTextChoiceAnswer (struct SurveyQuestion *SvyQst,unsigned Num static unsigned Svy_GetQstIndFromQstCod (long QstCod); static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod); static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQst); +static void Svy_PutIconToAddNewQuestion (void); +static void Svy_PutButtonToCreateNewQuestion (void); static void Svy_WriteParamEditQst (struct SurveyQuestion *SvyQst); static void Svy_WriteQstStem (const char *Stem); static void Svy_WriteAnswersOfAQst (struct Survey *Svy,struct SurveyQuestion *SvyQst,bool PutFormAnswerSurvey); @@ -205,7 +210,7 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst) if (Gbl.CurrentCrs.Grps.NumGrps) Svy_PutFormToSelectWhichGroupsToShow (); - if (Gbl.Asgs.Num) + if (Gbl.Svys.Num) { /***** Table head *****/ fprintf (Gbl.F.Out,"" @@ -1186,7 +1191,7 @@ static void Svy_PutParamSvyCod (long SvyCod) /******************** Get parameter with code of survey **********************/ /*****************************************************************************/ -long Svy_GetParamSvyCod (void) +static long Svy_GetParamSvyCod (void) { char LongStr[1+10+1]; @@ -1300,7 +1305,6 @@ void Svy_RemoveSurvey (void) void Svy_AskResetSurvey (void) { extern const char *Txt_Do_you_really_want_to_reset_the_survey_X; - extern const char *Txt_Reset_survey; struct Survey Svy; struct SurveyQuestion SvyQst; @@ -1325,13 +1329,24 @@ void Svy_AskResetSurvey (void) /***** Button of confirmation of reset *****/ Gbl.Svys.SvyCodToEdit = Svy.SvyCod; + Svy_PutButtonToResetSurvey (); + + /***** Show surveys again *****/ + Svy_ListAllSurveys (&SvyQst); + } + +/*****************************************************************************/ +/************************* Put button to reset survey ************************/ +/*****************************************************************************/ + +static void Svy_PutButtonToResetSurvey (void) + { + extern const char *Txt_Reset_survey; + Act_FormStart (ActRstSvy); Svy_PutParams (); Lay_PutConfirmButton (Txt_Reset_survey); Act_FormEnd (); - - /***** Show surveys again *****/ - Svy_ListAllSurveys (&SvyQst); } /*****************************************************************************/ @@ -2797,7 +2812,6 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ extern const char *Txt_This_survey_has_no_questions; extern const char *Txt_Send_survey; extern const char *Txt_Edit_question; - extern const char *Txt_New_question; char Query[512]; MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -2814,20 +2828,22 @@ 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 (PutFormAnswerSurvey) - { - /***** Start form to send answers to survey *****/ - Act_FormStart (ActAnsSvy); - Svy_PutParamSvyCod (Svy->SvyCod); - } - /***** Start frame *****/ - Lay_StartRoundFrameTable (NULL,2,Txt_Questions); + Gbl.Svys.SvyCodToEdit = Svy->SvyCod; + Lay_StartRoundFrame (NULL,Txt_Questions,Svy_PutIconToAddNewQuestion); if (NumQsts) { + if (PutFormAnswerSurvey) + { + /***** Start form to send answers to survey *****/ + Act_FormStart (ActAnsSvy); + Svy_PutParamSvyCod (Svy->SvyCod); + } + /***** Write the heading *****/ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,"
" + ""); if (Svy->Status.ICanEdit) fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,""); } + + fprintf (Gbl.F.Out,"
" @@ -2911,45 +2927,57 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ fprintf (Gbl.F.Out,"" "
"); + + if (PutFormAnswerSurvey) + { + /***** Button to create/modify survey *****/ + Lay_PutConfirmButton (Txt_Send_survey); + + /***** End form *****/ + Act_FormEnd (); + } } else // This survey has no questions - fprintf (Gbl.F.Out,"" - "" - "(%s)" - "" - "", - Txt_This_survey_has_no_questions); + Lay_ShowAlert (Lay_INFO,Txt_This_survey_has_no_questions); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); - if (PutFormAnswerSurvey) - { - /***** Button to create/modify survey *****/ - fprintf (Gbl.F.Out,"" - ""); - Lay_PutConfirmButton (Txt_Send_survey); - fprintf (Gbl.F.Out,"" - ""); - } - else if (Svy->Status.ICanEdit && Editing) - { - /***** Put form to add a new question in this survey *****/ - fprintf (Gbl.F.Out,"" - ""); - Gbl.Svys.SvyCodToEdit = Svy->SvyCod; - Lay_PutContextualLink (ActEdiOneSvyQst,Svy_PutParams,"plus64x64.png", - Txt_New_question,Txt_New_question); - fprintf (Gbl.F.Out,"" - ""); - } + if (Svy->Status.ICanEdit && Editing) + /***** Put button to add a new question in this survey *****/ + Svy_PutButtonToCreateNewQuestion (); /***** Table end *****/ - Lay_EndRoundFrameTable (); + Lay_EndRoundFrame (); + } - if (PutFormAnswerSurvey) - /***** End form *****/ - Act_FormEnd (); +/*****************************************************************************/ +/***************** Put icon to add a new question to survey ******************/ +/*****************************************************************************/ + +static void Svy_PutIconToAddNewQuestion (void) + { + extern const char *Txt_New_question; + + /***** Put form to create a new question *****/ + Lay_PutContextualLink (ActEdiOneSvyQst,Svy_PutParams, + "plus64x64.png",Txt_New_question,NULL); + } + +/*****************************************************************************/ +/**************** Put button to add a new question to survey *****************/ +/*****************************************************************************/ + +static void Svy_PutButtonToCreateNewQuestion (void) + { + extern const char *Txt_New_question; + + Act_FormStart (ActEdiOneSvyQst); + Svy_PutParams (); + Lay_PutConfirmButton (Txt_New_question); + Act_FormEnd (); } /*****************************************************************************/ diff --git a/swad_text.c b/swad_text.c index 90231bb85..b5b96a206 100644 --- a/swad_text.c +++ b/swad_text.c @@ -23030,17 +23030,17 @@ const char *Txt_New_plugin = const char *Txt_New_question = #if L==1 - "Pregunta nova"; + "Nova pregunta"; #elif L==2 "Neuer Frage"; #elif L==3 "New question"; #elif L==4 - "Pregunta nueva"; + "Nueva pregunta"; #elif L==5 "Nouvelle question"; #elif L==6 - "Pregunta nueva"; // Okoteve traducción + "Nueva pregunta"; // Okoteve traducción #elif L==7 "Nuova domanda"; #elif L==8 @@ -45728,23 +45728,23 @@ const char *Txt_This_post_has_been_banned_probably_for_not_satisfy_the_rules_of_ const char *Txt_This_survey_has_no_questions = #if L==1 - "Aquesta enquesta no té preguntes"; + "Aquesta enquesta no té preguntes."; #elif L==2 - "Diese Umfrage hat keine Fragen"; + "Diese Umfrage hat keine Fragen."; #elif L==3 - "This survey has no questions"; + "This survey has no questions."; #elif L==4 - "Esta encuesta no tiene preguntas"; + "Esta encuesta no tiene preguntas."; #elif L==5 - "Ce sondage n'a pas de questions"; + "Ce sondage n'a pas de questions."; #elif L==6 - "Esta encuesta no tiene preguntas"; // Okoteve traducción + "Esta encuesta no tiene preguntas."; // Okoteve traducción #elif L==7 - "Questo sondaggio non ha domande"; + "Questo sondaggio non ha domande."; #elif L==8 - "Badanie to nie ma pytania"; + "Badanie to nie ma pytania."; #elif L==9 - "Este inquérito não tem perguntas"; + "Este inquérito não tem perguntas."; #endif const char *Txt_Thread =