From 0d0b59b0e6c71c313c23b6b0c85ca8266cb0b1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 11 Apr 2015 20:18:30 +0200 Subject: [PATCH] Version 14.111 --- swad_assignment.c | 4 +- swad_attendance.c | 6 +- swad_changelog.h | 7 +- swad_survey.c | 164 +++++++++++++++++++++++----------------------- swad_test.c | 6 +- swad_text.c | 84 ++++++------------------ 6 files changed, 119 insertions(+), 152 deletions(-) diff --git a/swad_assignment.c b/swad_assignment.c index 46ebcdfc0..5732fe709 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -1054,7 +1054,7 @@ void Asg_RequestCreatOrEditAsg (void) extern const char *Txt_Folder; extern const char *Txt_Description; extern const char *Txt_Create_assignment; - extern const char *Txt_Modify_assignment; + extern const char *Txt_Save; struct Assignment Asg; bool ItsANewAssignment; Asg_StartOrEndTime_t StartOrEndTime; @@ -1215,7 +1215,7 @@ void Asg_RequestCreatOrEditAsg (void) if (ItsANewAssignment) Lay_PutCreateButton (Txt_Create_assignment); else - Lay_PutConfirmButton (Txt_Modify_assignment); + Lay_PutConfirmButton (Txt_Save); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_attendance.c b/swad_attendance.c index 8874f8a96..ff91197e3 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -1024,7 +1024,7 @@ void Att_RequestCreatOrEditAttEvent (void) extern const char *Txt_Visible_MALE_PLURAL; extern const char *Txt_Description; extern const char *Txt_Create_event; - extern const char *Txt_Modify_event; + extern const char *Txt_Save; struct AttendanceEvent Att; bool ItsANewAttEvent; Att_StartOrEndTime_t StartOrEndTime; @@ -1190,7 +1190,7 @@ void Att_RequestCreatOrEditAttEvent (void) if (ItsANewAttEvent) Lay_PutCreateButton (Txt_Create_event); else - Lay_PutConfirmButton (Txt_Modify_event); + Lay_PutConfirmButton (Txt_Save); fprintf (Gbl.F.Out,"" ""); @@ -2656,7 +2656,7 @@ void Usr_ReqListAttendanceStdsCrs (void) /* Send button */ fprintf (Gbl.F.Out,"" - ""); + ""); Lay_PutConfirmButton (Txt_Show_list); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_changelog.h b/swad_changelog.h index 04480b7ac..e79e6ecdf 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -103,12 +103,15 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.110.14 (2015/04/11)" +#define Log_PLATFORM_VERSION "SWAD 14.111 (2015/04/11)" // 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 14.110.14:Apr 11, 2015 Changes in layout of surveys. (? lines) + Version 14.111: Apr 11, 2015 Changes in layout of surveys. + Fixed bugs in surveys. + Changes in layout of edition of test questions. + Changes in layout of users' attendance. (184723 lines) Version 14.110.13:Apr 11, 2015 Changes in layout of users' attendance. (184750 lines) Version 14.110.12:Apr 11, 2015 Changes in layout of users' works. (184728 lines) Version 14.110.11:Apr 11, 2015 Changes in layout of selection of class photo / list. (184722 lines) diff --git a/swad_survey.c b/swad_survey.c index ab716ad68..8b543c878 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -418,33 +418,6 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,bool Sh Gbl.ColorRows[Gbl.RowEvenOdd]); fprintf (Gbl.F.Out,"\">"); Svy_WriteStatus (&Svy); - - if (!ShowOnlyThisSvyComplete) - { - /* Possible button to answer this survey */ - if (Svy.Status.ICanAnswer) - { - Act_FormStart (ActSeeOneSvy); - Svy_PutParamSvyCod (Svy.SvyCod); - Svy_PutHiddenParamSvyOrderType (); - Grp_PutParamWhichGrps (); - Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); - Lay_PutConfirmButton (Txt_Answer_survey); - Act_FormEnd (); - } - /* Possible button to see the result of the survey */ - else if (Svy.Status.ICanViewResults) - { - Act_FormStart (ActSeeOneSvy); - Svy_PutParamSvyCod (Svy.SvyCod); - Svy_PutHiddenParamSvyOrderType (); - Grp_PutParamWhichGrps (); - Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); - Lay_PutConfirmButton (Txt_View_survey_results); - Act_FormEnd (); - } - } - fprintf (Gbl.F.Out,"" ""); @@ -472,7 +445,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,bool Sh fprintf (Gbl.F.Out,"\">"); /* Scope of the survey */ - fprintf (Gbl.F.Out,"

%s: ", + fprintf (Gbl.F.Out,"

%s: ", Svy.Status.Visible ? "ASG_GRP" : "ASG_GRP_LIGHT", Txt_Scope); @@ -484,10 +457,10 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,bool Sh Txt_Degree,Gbl.CurrentDeg.Deg.ShortName); else fprintf (Gbl.F.Out,"%s",Cfg_PLATFORM_SHORT_NAME); - fprintf (Gbl.F.Out,"

"); + fprintf (Gbl.F.Out,"
"); /* Users' roles who can answer the survey */ - fprintf (Gbl.F.Out,"

%s:", + fprintf (Gbl.F.Out,"

%s:", Svy.Status.Visible ? "ASG_GRP" : "ASG_GRP_LIGHT", Txt_Users); @@ -505,7 +478,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,bool Sh fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out," />%s",Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN]); } - fprintf (Gbl.F.Out,"

"); + fprintf (Gbl.F.Out,"
"); /* Groups whose users can answer this survey */ if (Svy.CrsCod > 0) @@ -518,21 +491,54 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,bool Sh Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML Str_InsertLinkInURLs (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links fprintf (Gbl.F.Out,"

" - "
%s
 

" + "%s" + "

" + "" "", Svy.Status.Visible ? "DAT" : "DAT_LIGHT", Txt); /***** Write questions of this survey *****/ + fprintf (Gbl.F.Out,"" + "" - ""); + fprintf (Gbl.F.Out,">"); + + /* Write questions of this survey **/ Svy_ListSvyQuestions (&Svy,SvyQst); - fprintf (Gbl.F.Out,"" - ""); } + else + { + fprintf (Gbl.F.Out," style=\"background-color:%s;\">", + Gbl.ColorRows[Gbl.RowEvenOdd]); + + /* Possible button to answer this survey */ + if (Svy.Status.ICanAnswer) + { + Act_FormStart (ActSeeOneSvy); + Svy_PutParamSvyCod (Svy.SvyCod); + Svy_PutHiddenParamSvyOrderType (); + Grp_PutParamWhichGrps (); + Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); + Lay_PutConfirmButton (Txt_Answer_survey); + Act_FormEnd (); + } + /* Possible button to see the result of the survey */ + else if (Svy.Status.ICanViewResults) + { + Act_FormStart (ActSeeOneSvy); + Svy_PutParamSvyCod (Svy.SvyCod); + Svy_PutHiddenParamSvyOrderType (); + Grp_PutParamWhichGrps (); + Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); + Lay_PutConfirmButton (Txt_View_survey_results); + Act_FormEnd (); + } + } + fprintf (Gbl.F.Out,"" + ""); Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; @@ -1489,7 +1495,7 @@ void Svy_RequestCreatOrEditSvy (void) extern const char *Txt_Description; extern const char *Txt_Users; extern const char *Txt_Create_survey; - extern const char *Txt_Modify_survey; + extern const char *Txt_Save; struct Survey Svy; struct SurveyQuestion SvyQst; bool ItsANewSurvey; @@ -1671,7 +1677,7 @@ void Svy_RequestCreatOrEditSvy (void) if (ItsANewSurvey) Lay_PutCreateButton (Txt_Create_survey); else - Lay_PutConfirmButton (Txt_Modify_survey); + Lay_PutConfirmButton (Txt_Save); fprintf (Gbl.F.Out,"" ""); @@ -2162,7 +2168,7 @@ static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Survey *Svy) NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get groups of a survey"); /***** Write heading *****/ - fprintf (Gbl.F.Out,"

%s: ", + fprintf (Gbl.F.Out,"

%s: ", Svy->Status.Visible ? "ASG_GRP" : "ASG_GRP_LIGHT", NumRows == 1 ? Txt_Group : @@ -2196,7 +2202,7 @@ static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Survey *Svy) fprintf (Gbl.F.Out,"%s %s", Txt_The_whole_course,Gbl.CurrentCrs.Crs.ShortName); - fprintf (Gbl.F.Out,"

"); + fprintf (Gbl.F.Out,"
"); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -2364,6 +2370,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,ch extern const char *Txt_Type; extern const char *Txt_SURVEY_STR_ANSWER_TYPES[Svy_NUM_ANS_TYPES]; extern const char *Txt_Save; + extern const char *Txt_Create_question; char Query[512]; MYSQL_RES *mysql_res; MYSQL_ROW row; @@ -2512,7 +2519,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,ch if (SvyQst->QstCod > 0) // If the question already has assigned a code Lay_PutConfirmButton (Txt_Save); else - Lay_PutCreateButton (Txt_Save); + Lay_PutCreateButton (Txt_Create_question); fprintf (Gbl.F.Out,"" ""); @@ -2940,6 +2947,10 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ MYSQL_ROW row; unsigned NumQsts; unsigned NumQst; + bool Editing = (Gbl.CurrentAct == ActEdiOneSvy || + Gbl.CurrentAct == ActEdiOneSvyQst || + Gbl.CurrentAct == ActRcvSvyQst); + bool FormAnswerSurvey = Svy->Status.ICanAnswer && !Editing; /***** Get data of questions from database *****/ sprintf (Query,"SELECT QstCod,QstInd,AnsType,Stem" @@ -2947,19 +2958,15 @@ 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 (Svy->Status.ICanAnswer) + if (FormAnswerSurvey) { /***** Start form to send answers to survey *****/ Act_FormStart (ActAnsSvy); Svy_PutParamSvyCod (Svy->SvyCod); } - Lay_StartRoundFrameTable10 (NULL,0,NULL); - /***** Heading title *****/ - fprintf (Gbl.F.Out,"" - ""); - Lay_WriteTitle (Txt_Survey_questions); - fprintf (Gbl.F.Out,""); + /***** Start frame *****/ + Lay_StartRoundFrameTable10 (NULL,2,Txt_Survey_questions); if (NumQsts) { @@ -3066,46 +3073,41 @@ static void Svy_ListSvyQuestions (struct Survey *Svy,struct SurveyQuestion *SvyQ "", Txt_This_survey_has_no_questions); - fprintf (Gbl.F.Out,"
" - "" - ""); - /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); - if (Svy->Status.ICanAnswer) + if (FormAnswerSurvey) { - /***** Table end *****/ - Lay_EndRoundFrameTable10 (); - /***** 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,"" + ""); + Act_FormStart (ActEdiOneSvyQst); + Svy_PutParamSvyCod (Svy->SvyCod); + Svy_PutHiddenParamSvyOrderType (); + Grp_PutParamWhichGrps (); + Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); + Act_LinkFormSubmit (Txt_New_question,The_ClassFormulB[Gbl.Prefs.Theme]); + Lay_PutSendIcon ("new",Txt_New_question,Txt_New_question); + Act_FormEnd (); + fprintf (Gbl.F.Out,"" + ""); + } + /***** Table end *****/ + Lay_EndRoundFrameTable10 (); + + if (FormAnswerSurvey) /***** End form *****/ Act_FormEnd (); - } - else - { - if (Svy->Status.ICanEdit) - { - /***** Put form to add a new question in this survey *****/ - fprintf (Gbl.F.Out,"" - ""); - Act_FormStart (ActEdiOneSvyQst); - Svy_PutParamSvyCod (Svy->SvyCod); - Svy_PutHiddenParamSvyOrderType (); - Grp_PutParamWhichGrps (); - Pag_PutHiddenParamPagNum (Gbl.Pag.CurrentPage); - Act_LinkFormSubmit (Txt_New_question,The_ClassFormulB[Gbl.Prefs.Theme]); - Lay_PutSendIcon ("new",Txt_New_question,Txt_New_question); - Act_FormEnd (); - fprintf (Gbl.F.Out,"" - ""); - } - - /***** Table end *****/ - Lay_EndRoundFrameTable10 (); - } } /*****************************************************************************/ @@ -3140,9 +3142,9 @@ static void Svy_WriteQstStem (const char *Stem,const char *TextStyle) /* Write the stem */ fprintf (Gbl.F.Out,"" - "

" + "

" "%s" - "

", + "
", TextStyle,Gbl.ColorRows[Gbl.RowEvenOdd],HeadingRigorousHTML); /* Free memory allocated for the stem */ diff --git a/swad_test.c b/swad_test.c index 3c2aefccf..1ca072bc2 100644 --- a/swad_test.c +++ b/swad_test.c @@ -4095,6 +4095,7 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback) extern const char *Txt_Answer; extern const char *Txt_Shuffle; extern const char *Txt_Save; + extern const char *Txt_Create_question; char Title[512]; char Query[512]; MYSQL_RES *mysql_res; @@ -4513,7 +4514,10 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback) /***** Send button *****/ fprintf (Gbl.F.Out,"" ""); - Lay_PutConfirmButton (Txt_Save); + if (Gbl.Test.QstCod > 0) // The question already has assigned a code + Lay_PutConfirmButton (Txt_Save); + else + Lay_PutCreateButton (Txt_Create_question); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_text.c b/swad_text.c index c9a864963..a4a891f7a 100644 --- a/swad_text.c +++ b/swad_text.c @@ -5848,6 +5848,27 @@ const char *Txt_Create_plugin = "Criar plugin"; #endif +const char *Txt_Create_question = +#if L==0 + "Crear pregunta"; +#elif L==1 + "Frage erstellen"; +#elif L==2 + "Create question"; +#elif L==3 + "Crear pregunta"; +#elif L==4 + "Créer question"; +#elif L==5 + "Crear pregunta"; // Okoteve traducción +#elif L==6 + "Crea domanda"; +#elif L==7 + "Tworzenie pytanie"; +#elif L==8 + "Criar questão"; +#endif + const char *Txt_Create_record_field = #if L==0 "Crear campo de ficha"; // Necessita traduccio @@ -20544,48 +20565,6 @@ const char *Txt_minutes = "minutos"; #endif -const char *Txt_Modify_assignment = -#if L==0 - "Modificar actividad"; // Necessita traduccio -#elif L==1 - "Ändern Aufgabe"; -#elif L==2 - "Modify assignment"; -#elif L==3 - "Modificar actividad"; -#elif L==4 - "Modifier activité"; -#elif L==5 - "Modificar actividad"; // Okoteve traducción -#elif L==6 - "Modifica attività"; -#elif L==7 - "Modyfikacja zadania"; -#elif L==8 - "Modificar atividade"; -#endif - -const char *Txt_Modify_event = -#if L==0 - "Modificar evento"; // Necessita traduccio -#elif L==1 - "Ändern Ereignis"; -#elif L==2 - "Modify event"; -#elif L==3 - "Modificar evento"; -#elif L==4 - "Modifier événement"; -#elif L==5 - "Modificar evento"; // Okoteve traducción -#elif L==6 - "Modifica evento"; -#elif L==7 - "Modyfikacja wydarzenie"; -#elif L==8 - "Modificar evento"; -#endif - const char *Txt_Modify_me_in_the_course_X = // Warning: it is very important to include %s in the following sentences #if L==0 "Modificarme en l'assignatura %s"; @@ -20628,27 +20607,6 @@ const char *Txt_Modify_user_in_the_course_X = // Warning: it is very important t "Modificar utilizador na disciplina %s"; #endif -const char *Txt_Modify_survey = -#if L==0 - "Modifier sondage"; // Necessita traduccio -#elif L==1 - "Ändern Umfrage"; -#elif L==2 - "Modify survey"; -#elif L==3 - "Modificar encuesta"; -#elif L==4 - "Modifier sondage"; -#elif L==5 - "Modificar encuesta"; // Okoteve traducción -#elif L==6 - "Modifica sondaggio"; -#elif L==7 - "Badanie Modyfikuj"; -#elif L==8 - "Modificar inquérito"; -#endif - const char *Txt_Month = #if L==0 "Mes"; // Necessita traduccio