Version 15.175.4

This commit is contained in:
Antonio Cañas Vargas 2016-04-03 15:53:27 +02:00
parent 344d1f3208
commit 77f1f65c62
4 changed files with 114 additions and 17 deletions

View File

@ -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)

View File

@ -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 *****************************/
/*****************************************************************************/

View File

@ -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,"<input type=\"radio\" name=\"Image\" value=\"%u\"",
Img_ACTION_NONE);
if (!Gbl.Test.Image[0])
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />"
"<label class=\"%s\">"
"%s"
"</label><br />",
The_ClassForm[Gbl.Prefs.Theme],
Txt_No_image);
/***** Current image *****/
if (Gbl.Test.Image[0])
fprintf (Gbl.F.Out,"<label class=\"%s\">"
"%s: "
"</label>",
The_ClassForm[Gbl.Prefs.Theme],Txt_Change_image);
{
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"Image\" value=\"%u\" checked=\"checked\" />"
"<label class=\"%s\">"
"%s"
"</label><br />",
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,"<input id=\"change_image\" type=\"radio\" name=\"Image\" value=\"%u\">",
Img_ACTION_CHANGE);
fprintf (Gbl.F.Out,"<label class=\"%s\">"
"%s: "
"</label>",
The_ClassForm[Gbl.Prefs.Theme],
Gbl.Test.Image[0] ? Txt_Change_image :
Txt_New_image);
fprintf (Gbl.F.Out,"<input type=\"file\" name=\"%s\""
" size=\"40\" maxlength=\"100\" value=\"\" />",
" 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)
"<td class=\"LEFT_TOP\">",
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,"</td>"
"</tr>");

View File

@ -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&zdot;&aogon;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&eacute;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'&atilde;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&oacute;n (universitat, institut, escola, acad&egrave;mia, organitzaci&oacute;, 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&ordm;"; // Necessita traduccio