Version 15.181

This commit is contained in:
Antonio Cañas Vargas 2016-04-05 21:44:06 +02:00
parent 1402a4729c
commit 5c87432630
3 changed files with 68 additions and 21 deletions

View File

@ -131,13 +131,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.180.7 (2016-04-05)" #define Log_PLATFORM_VERSION "SWAD 15.181 (2016-04-05)"
#define CSS_FILE "swad15.178.2.css" #define CSS_FILE "swad15.178.2.css"
#define JS_FILE "swad15.178.2.js" #define JS_FILE "swad15.178.2.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
/* /*
Version 15.181: Apr 05, 2016 New fields in test questions with the title/attribution of images. (198515 lines)
Version 15.180.7: Apr 05, 2016 Changes in layout of editor of question. (198473 lines) Version 15.180.7: Apr 05, 2016 Changes in layout of editor of question. (198473 lines)
Version 15.180.6: Apr 05, 2016 Changes in layout of editor of question. (198490 lines) Version 15.180.6: Apr 05, 2016 Changes in layout of editor of question. (198490 lines)
Version 15.180.5: Apr 05, 2016 Changes in layout of editor of question. (198512 lines) Version 15.180.5: Apr 05, 2016 Changes in layout of editor of question. (198512 lines)

View File

@ -156,8 +156,10 @@ static void Tst_ShowTstResultAfterAssess (long TstCod,unsigned *NumQstsNotBlank,
static void Tst_WriteQstAndAnsExam (unsigned NumQst,long QstCod,MYSQL_ROW row, static void Tst_WriteQstAndAnsExam (unsigned NumQst,long QstCod,MYSQL_ROW row,
double *ScoreThisQst,bool *AnswerIsNotBlank); double *ScoreThisQst,bool *AnswerIsNotBlank);
static void Tst_PutFormToEditQstImage (struct Image *Image,const char *ClassImg, static void Tst_PutFormToEditQstImage (struct Image *Image,const char *ClassImg,
const char *TitleAttribution,const char *ClassTitle,
const char *ParamAction, const char *ParamAction,
const char *ParamFile, const char *ParamFile,
const char *ParamTitle,
bool OptionsDisabled); bool OptionsDisabled);
static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotBlank); static void Tst_UpdateScoreQst (long QstCod,float ScoreThisQst,bool AnswerIsNotBlank);
static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst); static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst);
@ -1045,8 +1047,10 @@ void Tst_WriteQstStem (const char *Stem,const char *ClassStem)
/*****************************************************************************/ /*****************************************************************************/
static void Tst_PutFormToEditQstImage (struct Image *Image,const char *ClassImg, static void Tst_PutFormToEditQstImage (struct Image *Image,const char *ClassImg,
const char *TitleAttribution,const char *ClassTitle,
const char *ParamAction, const char *ParamAction,
const char *ParamFile, const char *ParamFile,
const char *ParamTitle,
bool OptionsDisabled) bool OptionsDisabled)
{ {
extern const char *The_ClassForm[The_NUM_THEMES]; extern const char *The_ClassForm[The_NUM_THEMES];
@ -1055,9 +1059,13 @@ static void Tst_PutFormToEditQstImage (struct Image *Image,const char *ClassImg,
extern const char *Txt_Change_image; extern const char *Txt_Change_image;
extern const char *Txt_Image; extern const char *Txt_Image;
extern const char *Txt_optional; extern const char *Txt_optional;
extern const char *Txt_Image_title_attribution;
static unsigned UniqueId = 0; static unsigned UniqueId = 0;
/***** No image *****/ /***** Start container *****/
fprintf (Gbl.F.Out,"<div class=\"LEFT_TOP\">");
/***** Choice 1: No image *****/
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\" value=\"%u\"", fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\" value=\"%u\"",
ParamAction,Img_ACTION_NO_IMAGE); ParamAction,Img_ACTION_NO_IMAGE);
if (!Image->Name[0]) if (!Image->Name[0])
@ -1071,7 +1079,7 @@ static void Tst_PutFormToEditQstImage (struct Image *Image,const char *ClassImg,
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_No_image); Txt_No_image);
/***** Current image *****/ /***** Choice 2: Current image *****/
if (Image->Name[0]) if (Image->Name[0])
{ {
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\" value=\"%u\" checked=\"checked\"", fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\" value=\"%u\" checked=\"checked\"",
@ -1087,7 +1095,7 @@ static void Tst_PutFormToEditQstImage (struct Image *Image,const char *ClassImg,
Img_ShowImage (Image,ClassImg); Img_ShowImage (Image,ClassImg);
} }
/***** Change/new image *****/ /***** Choice 3: Change/new image *****/
UniqueId++; UniqueId++;
if (Image->Name[0]) // Image exists if (Image->Name[0]) // Image exists
{ {
@ -1117,13 +1125,32 @@ static void Tst_PutFormToEditQstImage (struct Image *Image,const char *ClassImg,
"</label>", "</label>",
The_ClassForm[Gbl.Prefs.Theme],Txt_Image,Txt_optional); The_ClassForm[Gbl.Prefs.Theme],Txt_Image,Txt_optional);
} }
/***** Image file *****/
fprintf (Gbl.F.Out,"<input type=\"file\" name=\"%s\"" fprintf (Gbl.F.Out,"<input type=\"file\" name=\"%s\""
" size=\"40\" maxlength=\"100\" value=\"\"", " size=\"40\" maxlength=\"100\" value=\"\"",
ParamFile); ParamFile);
if (OptionsDisabled) if (OptionsDisabled)
fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," onchange=\"document.getElementById('chg_img_%u').checked = true;\" />", fprintf (Gbl.F.Out," onchange=\"document.getElementById('chg_img_%u').checked = true;\" />"
"<br />",
UniqueId); UniqueId);
/***** Image title/attribution *****/
fprintf (Gbl.F.Out,"<label class=\"%s\">"
"%s (%s):"
"</label><br />"
"<textarea name=\"%s\" class=\"%s\" rows=\"1\">",
The_ClassForm[Gbl.Prefs.Theme],
Txt_Image_title_attribution,Txt_optional,
ParamTitle,ClassTitle);
if (TitleAttribution)
if (TitleAttribution[0])
fprintf (Gbl.F.Out,"%s",TitleAttribution);
fprintf (Gbl.F.Out,"</textarea>");
/***** End container *****/
fprintf (Gbl.F.Out,"</div>");
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4305,6 +4332,7 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
bool OptionsDisabled; bool OptionsDisabled;
char ParamAction[32]; char ParamAction[32];
char ParamFile[32]; char ParamFile[32];
char ParamTitle[32];
/***** If no receiving the question, but editing a new or existing question /***** If no receiving the question, but editing a new or existing question
==> init or edit data of question *****/ ==> init or edit data of question *****/
@ -4421,21 +4449,15 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Stem, Txt_Stem,
Stem); Stem);
Tst_PutFormToEditQstImage (&Gbl.Test.Image, Tst_PutFormToEditQstImage (&Gbl.Test.Image,"TEST_IMG_EDIT_ONE_STEM",
"TEST_IMG_EDIT_ONE_STEM", NULL,"STEM", // Title / attribution
"ImgAct","FileImg",false); "ImgAct","FileImg","TitImg",false);
fprintf (Gbl.F.Out,"</td>"
"</tr>");
/***** Feedback *****/ /***** Feedback *****/
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<label class=\"%s\">"
"<td class=\"RIGHT_TOP\">"
"<label class=\"%s\">"
"%s (%s):" "%s (%s):"
"</label>" "</label><br />"
"</td>" "<textarea name=\"Feedback\" class=\"STEM\" rows=\"2\">",
"<td class=\"LEFT_TOP\">"
"<textarea name=\"Feedback\" class=\"STEM\" rows=\"3\">",
The_ClassForm[Gbl.Prefs.Theme], The_ClassForm[Gbl.Prefs.Theme],
Txt_Feedback,Txt_optional); Txt_Feedback,Txt_optional);
if (Feedback) if (Feedback)
@ -4588,7 +4610,7 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
/* Answer text */ /* Answer text */
fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">" fprintf (Gbl.F.Out,"<td class=\"LEFT_TOP COLOR%u\">"
"<textarea name=\"AnsStr%u\" class=\"ANS_STR\" rows=\"4\"", "<textarea name=\"AnsStr%u\" class=\"ANS_STR\" rows=\"5\"",
Gbl.RowEvenOdd, Gbl.RowEvenOdd,
NumOpt); NumOpt);
if (OptionsDisabled) if (OptionsDisabled)
@ -4604,11 +4626,14 @@ static void Tst_PutFormEditOneQst (char *Stem,char *Feedback)
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"LEFT_TOP COLOR%u\">", "<td class=\"LEFT_TOP COLOR%u\">",
Gbl.RowEvenOdd); Gbl.RowEvenOdd);
sprintf (ParamAction,"ImgAct%u",NumOpt); sprintf (ParamAction,"ImgAct%u" ,NumOpt);
sprintf (ParamFile,"FileImg%u",NumOpt); sprintf (ParamFile ,"FileImg%u",NumOpt);
sprintf (ParamTitle ,"TitImg%u" ,NumOpt);
Tst_PutFormToEditQstImage (&Gbl.Test.Answer.Options[NumOpt].Image, Tst_PutFormToEditQstImage (&Gbl.Test.Answer.Options[NumOpt].Image,
"TEST_IMG_EDIT_ONE_ANS", "TEST_IMG_EDIT_ONE_ANS",
ParamAction,ParamFile,OptionsDisabled); NULL,"ANS_STR", // Title / attribution
ParamAction,ParamFile,ParamTitle,
OptionsDisabled);
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
"</tr>"); "</tr>");

View File

@ -14306,6 +14306,27 @@ const char *Txt_Image =
"Imagem"; "Imagem";
#endif #endif
const char *Txt_Image_title_attribution =
#if L==1
"T&iacute;tol/reconeixement de la imatge";
#elif L==2
"Bildtitel / Namensnennung";
#elif L==3
"Image title/attribution";
#elif L==4
"T&iacute;tulo/reconocimiento de la imagen";
#elif L==5
"Titre/attribution de l'image";
#elif L==6
"T&iacute;tulo/reconocimiento de la imagen"; // Okoteve traducción
#elif L==7
"Titolo/attribuzione delle immagine";
#elif L==8
"Tytu&lstrok;/przypisanie obrazu";
#elif L==9
"T&iacute;tulo/atribui&ccedil;&atilde;o da imagem";
#endif
const char *Txt_Image_not_found = const char *Txt_Image_not_found =
#if L==1 #if L==1
"Imatge no trobat"; "Imatge no trobat";