diff --git a/swad_changelog.h b/swad_changelog.h index e797dff0a..8dd8cc345 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -140,14 +140,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.175.3 (2016-04-03)" +#define Log_PLATFORM_VERSION "SWAD 15.175.4 (2016-04-03)" #define CSS_FILE "swad15.173.1.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.175.4: Apr 03, 2016 Check button to remove image when editing one test question. (? lines) + Version 15.175.4: Apr 03, 2016 Changes in form to edit one test question. (197897 lines) Version 15.175.3: Apr 03, 2016 Change in edition of test question. (197804 lines) Version 15.175.2: Apr 03, 2016 Code refactoring related to deleting image file. (197773 lines) Version 15.175.1: Apr 03, 2016 Code refactoring related to deleting tests of a course. (197763 lines) diff --git a/swad_image.h b/swad_image.h index 05fa23b2f..e016a01cd 100644 --- a/swad_image.h +++ b/swad_image.h @@ -67,6 +67,14 @@ typedef enum Img_NAME_STORED_IN_DB, } Img_Status_t; +/***** Action to perform when editing a form with an image *****/ +typedef enum + { + Img_ACTION_NONE, // Do not use image (remove current image if exists) + Img_ACTION_KEEP, // Keep current image unchanged + Img_ACTION_CHANGE, // Upload new image (remove current image if exists) + } Img_Action_t; + /*****************************************************************************/ /***************************** Public prototypes *****************************/ /*****************************************************************************/ diff --git a/swad_test.c b/swad_test.c index 72da122fb..77fa114b7 100644 --- a/swad_test.c +++ b/swad_test.c @@ -155,7 +155,7 @@ static void Tst_ShowTestQuestionsWhenSeeing (MYSQL_RES *mysql_res); static void Tst_ShowTstResultAfterAssess (long TstCod,unsigned *NumQstsNotBlank,double *TotalScore); static void Tst_WriteQstAndAnsExam (unsigned NumQst,long QstCod,MYSQL_ROW row, double *ScoreThisQst,bool *AnswerIsNotBlank); -static void Tst_PutFormToUploadNewQstImage (void); +static void Tst_PutFormToEditQstImage (void); static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotBlank); static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst); static void Tst_UpdateLastAccTst (void); @@ -1027,21 +1027,51 @@ void Tst_WriteQstStem (const char *Stem,const char *ClassStem) /************* Put form to upload a new image for a test question ************/ /*****************************************************************************/ -static void Tst_PutFormToUploadNewQstImage (void) +static void Tst_PutFormToEditQstImage (void) { extern const char *The_ClassForm[The_NUM_THEMES]; + extern const char *Txt_No_image; + extern const char *Txt_Current_image; extern const char *Txt_Change_image; + extern const char *Txt_New_image; - /***** If an image exists, put label *****/ + /***** No image *****/ + fprintf (Gbl.F.Out,"" + "
", + The_ClassForm[Gbl.Prefs.Theme], + Txt_No_image); + + /***** Current image *****/ if (Gbl.Test.Image[0]) - fprintf (Gbl.F.Out,"", - The_ClassForm[Gbl.Prefs.Theme],Txt_Change_image); + { + fprintf (Gbl.F.Out,"" + "
", + Img_ACTION_KEEP, + The_ClassForm[Gbl.Prefs.Theme], + Txt_Current_image); + Img_ShowImage (Gbl.Test.Image,"TEST_IMG_EDIT_ONE"); + } - /****** Form field to upload a new image *****/ + /***** New image *****/ + fprintf (Gbl.F.Out,"", + Img_ACTION_CHANGE); + fprintf (Gbl.F.Out,"", + The_ClassForm[Gbl.Prefs.Theme], + Gbl.Test.Image[0] ? Txt_Change_image : + Txt_New_image); fprintf (Gbl.F.Out,"", + " size=\"40\" maxlength=\"100\" value=\"\"" + " onchange=\"document.getElementById('change_image').checked = true;\" />", Fil_NAME_OF_PARAM_FILENAME_ORG); } @@ -4316,11 +4346,7 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback) "", The_ClassForm[Gbl.Prefs.Theme], Txt_Image); - if (Gbl.Test.Image[0]) - Img_ShowImage (Gbl.Test.Image,"TEST_IMG_EDIT_ONE"); - Tst_PutFormToUploadNewQstImage (); - if (Gbl.Test.Image[0]) - + Tst_PutFormToEditQstImage (); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_text.c b/swad_text.c index 15e9817ed..8c9b5e05f 100644 --- a/swad_text.c +++ b/swad_text.c @@ -6904,6 +6904,27 @@ const char *Txt_Current_email = "E-mail atual"; #endif +const char *Txt_Current_image = +#if L==1 + "Imatge actual"; +#elif L==2 + "Aktuelles Abbild"; +#elif L==3 + "Current image"; +#elif L==4 + "Imagen actual"; +#elif L==5 + "Image actuelle"; +#elif L==6 + "Imagen actual"; // Okoteve traducción +#elif L==7 + "Immagine corrente"; +#elif L==8 + "Bieżący obraz"; +#elif L==9 + "Imagem atual"; +#endif + const char *Txt_Current_nickname = #if L==1 "Sobrenom actual"; @@ -22884,7 +22905,7 @@ const char *Txt_New_group = const char *Txt_New_holiday = #if L==1 - "Nueva festividad"; // Necessita traduccio + "Nova festivitat"; #elif L==2 "Neue Feiertag"; #elif L==3 @@ -22903,6 +22924,27 @@ const char *Txt_New_holiday = "Nova féria"; #endif +const char *Txt_New_image = +#if L==1 + "Nova imatge"; +#elif L==2 + "Neue Abbild"; +#elif L==3 + "New image"; +#elif L==4 + "Nueva imagen"; +#elif L==5 + "Nouvelle image"; +#elif L==6 + "Pyahu ta'ãnga"; +#elif L==7 + "Nuova immagine"; +#elif L==8 + "Nowe obraz"; +#elif L==9 + "Nova imagem"; +#endif + const char *Txt_New_institution_of_COUNTRY_X = // Warning: it is very important to include %s in the following sentences #if L==1 "Nova institución (universitat, institut, escola, acadèmia, organització, empresa...) de %s"; @@ -23740,6 +23782,27 @@ const char *Txt_No_groups_have_been_created_in_the_course_X_Therefore_ = // Warn "Therefore, the specified users will be enrolled/removed in/from the course."; // Necessita de tradução #endif +const char *Txt_No_image = // Without any image +#if L==1 + "Sense imatge"; +#elif L==2 + "Ohne Abbild"; +#elif L==3 + "No image"; +#elif L==4 + "Sin imagen"; +#elif L==5 + "Pas d'image"; +#elif L==6 + "Sin imagen"; // Okoteve traducción +#elif L==7 + "Nessuna immagine"; +#elif L==8 + "Brak obrazka"; +#elif L==9 + "Sem imagem"; +#endif + const char *Txt_No_INDEX = // Short version of "Number" (as an index)... #if L==1 "Nº"; // Necessita traduccio